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

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 Answer

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)
0

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like