SauceCat / PDPbox

python partial dependence plot toolbox
http://pdpbox.readthedocs.io/en/latest/
MIT License
840 stars 129 forks source link

Can't customise PDP plot colors #53

Closed lstodd closed 3 years ago

lstodd commented 5 years ago

It would be great to have the option to customise the PDPbox plot colours. Could this be added as a feature?

dyerrington commented 5 years ago

You can actually @lstodd. Check out the docs for the plot_params in most of the methods: https://pdpbox.readthedocs.io/en/latest/target_plot.html

These are sent to matplotlib. Also plotting methods return figure and axes and you can use those matplotlib objects to do whatever you like. The docs have a handy reference here for one of the plot methods that should apply to the other ones that have the same parameter: https://pdpbox.readthedocs.io/en/latest/pdp_plot.html

plot_params: dict or None, optional, default=None parameters for the plot, possible parameters as well as default as below:

plot_params = {
# plot title and subtitle
'title': 'PDP for feature "%s"' % feature_name,
'subtitle': "Number of unique grid points: %d" % n_grids,
'title_fontsize': 15,
'subtitle_fontsize': 12,
'font_family': 'Arial',
# matplotlib color map for ICE lines
'line_cmap': 'Blues',
'xticks_rotation': 0,
# pdp line color, highlight color and line width
'pdp_color': '#1A4E5D',
'pdp_hl_color': '#FEDC00',
'pdp_linewidth': 1.5,
# horizon zero line color and with
'zero_color': '#E75438',
'zero_linewidth': 1,
# pdp std fill color and alpha
'fill_color': '#66C2D7',
'fill_alpha': 0.2,
# marker size for pdp line
'markersize': 3.5,
}