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)What the rule reports
Section titled “What the rule reports”Calls to beeswarm(...) that pass a non-None ax= without plot_size=None.
How to fix it
Section titled “How to fix it”Pass plot_size=None whenever supplying ax=, and configure the figure dimensions via plt.subplots(figsize=...).
Diagnostic message
Section titled “Diagnostic message”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.