Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to edit size of axes text size on SHAP depedence plot in Python

I have used this code:
for i in range(len(col_list)):

    shap.dependence_plot(i, shap_values, X.values, feature_names=X.columns, dot_size=10, interaction_index=None, x_jitter=-0.5)

to generate the following SHAP dependence plot:

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Does anyone know how to modify the size of the text in the x-axis so that it becomes smaller?
For example, 150000 doesn’t overlap with 175000…

>Solution :

I’m not familiar with SHAP, but my guess is it looks like it returns a matplotlib Figure object. In that case, the following should work

shap_figure = shap.dependence_plot(i, shap_values, X.values, feature_names=X.columns, dot_size=10, interaction_index=None, x_jitter=-0.5)

ax_list = shap_figure .axes # see https://stackoverflow.com/a/24107230/11148296
ax = ax_list[0]
ax.set_xlabel('Time', fontsize=14)
ax.set_ylabel('Values', fontsize=14)

shap_figure 
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading