I'm plotting some partial dependency plots using matplotlib. I have 1,000 samples which I produce regression predictions for. These predictions are plotted on the y-axis. To get an overview of partial dependency for the whole dataset I'm fixing all variables in my samples bar one. The un-fixed variable is shown on the x-axis and is varied for all samples.
On my plot I want to show the mean value that my 1,000 samples take for a given x value, and the distribution of values plotted as a colour gradient at that x value. At the moment I have the following:
This is functional, because it shows the density of predictions for a given x value, but ugly. I want something that does the same job of showing density at each x value, but that is a smooth gradient that fills the plot, not individual points.
How would I achieve something like this?