I am trying to plot a grid of dependence plots from the shap package. Here is MWE code for an example of what I want:
fig, axs = plt.subplots(2,8, figsize=(16, 4), facecolor='w', edgecolor='k') # figsize=(width, height)
fig.subplots_adjust(hspace = .5, wspace=.001)
axs = axs.ravel()
for i in range(10):
axs[i].contourf(np.random.rand(12,12),5,cmap=plt.cm.Oranges)
axs[i].set_title(str(250+i))
plt.show()
Here is the code I have so far. A few things aren't working:
- The figure size of my grid aren't impacted by my
figsizearguments - My code plots bigger versions of my plots beneath the grid.
- Only one of the dependence plots is showing in the grid.
fig, axs = plt.subplots(1,8, figsize=(4, 2))
axs = axs.ravel()
for b in X_test.columns[:3]:
for a in X_test.columns[:3]:
shap.dependence_plot((a, b), shap_interaction_values, X_test)

