在SHAP力图中,有没有办法将x轴的值更改为自定义名称?
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'])
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})
如果您想更改功能字体大小,此代码对我有用:
shap.summary_plot(shap_values, show=False)
图, ax = plt.gcf(), plt.gca()
对于 ax.texts 中的文本: text.set_fontsize( your_font_size_number)
plt.show()