'Accessing matplotlib colorbar title in SHAP Dependence Plot
I want to change the title of the colorbar in the SHAP dependence plot. A dependence plot is created with:
shap.dependence_plot("Age", shap_values, X, interaction_index="Education-Num", show=False)
The plot can be extracted with
fig, ax = plt.gcf(), plt.gca()
This allows for changes e.g. to the x-limits.
plt.xlim(0,10)
When trying to access the colorbar title with
clb = plt.colorbar()
clb.ax.set_title('New Label',fontsize=8)
a secondary colorbar is created, in addition to the existing one. How can the existing colorbar title be overwritten, without creating a new one? Thank you in advance.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
