Nikka Sparks
Nikka Sparks

Reputation: 1

In SHAP force plot, is there a way to change the value of x-axis to custom name?

In the SHAP force plot, is there a way to change the value of the x-axis to a custom name?

f = plt.figure(figsize=(8, 6))
shap.summary_plot(shap_values, X_test, plot_type="bar", feature_names=X_train.columns, class_names = ORGD_Test['Class']) 

Upvotes: 0

Views: 1390

Answers (2)

Amaury Ribeiro
Amaury Ribeiro

Reputation: 1

If you wanna change the feature font size,this code works for me:

shap.summary_plot(shap_values, show=False)

# Get the current figure and axes objects.
fig, ax = plt.gcf(), plt.gca()

for text in ax.texts:
   text.set_fontsize( your_font_size_number)

plt.show()

Upvotes: 0

Snehal Rajput
Snehal Rajput

Reputation: 436

shap.summary_plot(shap_values, show=False)

# Get the current figure and axes objects.
fig, ax = plt.gcf(), plt.gca()

# Set the limits for the x-axis and similarly can be done for the y-axis also
ax.set_xlim(-60, 125)
ax.set_xlim(-60, 125)
ax.set_title(ax_title, fontdict={"size":font_size})

Upvotes: 0

Related Questions