Skip to content

shaply

Usual SHAP explainability figures, rendered as interactive Plotly charts.

shaply reproduces the familiar figures from the shap library — bar, beeswarm, waterfall, dependence (scatter) and heatmap — but returns plotly.graph_objects.Figure objects instead of matplotlib axes, so the plots are interactive and embeddable out of the box.

It does not depend on shap: every plotting function accepts a shap.Explanation-like object, a raw NumPy array of SHAP values, or a pandas DataFrame.

Install

uv add shaply
# or
pip install shaply

Quickstart

import shaply

fig = shaply.beeswarm(shap_values)  # a shap.Explanation, ndarray or DataFrame
fig.show()

Every plotting function accepts an optional typed config object (see Configuration) to override defaults such as colors, ordering, or layout.

Where to go next

  • Usual plots — the shap.plots-equivalent figures: bar, beeswarm, waterfall, scatter, heatmap, decision, force.
  • Advanced plots — diagnostics not found in shap itself: error analysis, monotonicity checks, feature clustering, response curves, and more.
  • Configuration — the typed *Config objects accepted by each plot.
  • Core objectsExplanation, InteractionValues, and the coercion helpers.

The full source is on GitHub; a runnable example notebook lives in examples/.