Skip to content

shap/beeswarm-ax-with-plot-size

Pack Severity Fix Versions
shap error none, edit by hand All versions

shap.plots.beeswarm(..., ax=ax) raises ValueError unless plot_size=None is also passed, because plot_size defaults to "auto" and SHAP refuses to resize an externally supplied axes.

shap.plots.beeswarm(explanation, ax=ax, show=False)
shap.plots.beeswarm(explanation, ax=ax, plot_size=None, show=False)

Calls to beeswarm(...) that pass a non-None ax= without plot_size=None.

Pass plot_size=None whenever supplying ax=, and configure the figure dimensions via plt.subplots(figsize=...).

shap.plots.beeswarm() raises ValueError when ax= is passed without plot_size=None because plot_size defaults to 'auto'. Pass plot_size=None and set the size on the matplotlib Figure instead.

See all rules in the shap pack.