How to remove decile marks in partial dependence plots of sklearn?

Viewed 125

In this example on how to create partial dependence plots, it is explained that the ticks on the x-axis are decile marks. However, the API does not tell how to active/deactivate them. I tried finding a way of removing those, but so far no success has been achieved.

I'd appreciate any help in removing the bottom ticks. Thank you!

Partial dependence plots

1 Answers

The lines are attributes of the PartialDependenceDisplay returned by plot_partial_dependence. The attributes are called deciles_vlines_ (for vertical lines) and deciles_hlines_ for horizontal lines. If you don't want to show them you can set them to not be visible with e.g. plt.setp

import matplotlib.pyplot as plt
disp = plot_partial_dependence(...)
plt.setp(disp.deciles_vlines_, visible=False)
Related