plot_qshap: Plot Q-SHAP R-squared contributions

plot_qshapR Documentation

Plot Q-SHAP R-squared contributions

Description

Convenience wrapper that works for both a 'qshap_rsq' object and a plain numeric vector of contributions. Use this if you have a numeric vector and still want to pass arguments like 'color_map_name'.

Usage

plot_qshap(
  x,
  type = c("rsq", "elbow", "cumu", "gcorr", "hist", "density", "loss", "heatmap",
    "loss_heatmap"),
  ...
)

Arguments

x

A 'qshap_rsq' object (recommended) or a numeric vector.

type

Plot type; see 'plot.qshap_rsq'. Use '"loss"' to launch the interactive explorer or '"heatmap"' for the static raster heatmap.

...

Additional arguments passed to the underlying visualization function (e.g., 'label', 'rotation', 'color_map_name', 'max_feature').

Value

The ggplot2 plot object (invisibly)

Examples

library(xgboost)
set.seed(42)
n <- 100
p <- 100
X <- matrix(rnorm(n * p), nrow = n, ncol = p)
y <- X[, 1] - X[, 2] + rnorm(n, sd = 0.2)
model <- xgboost(X, y, nrounds = 15L, max_depth = 2L, verbosity = 0L, nthreads = 1L)
explainer <- gazer(model)
phi_rsq <- rsq(explainer, X, y)
plot(phi_rsq)


qshap documentation built on Aug. 23, 2026, 5:11 p.m.