Closed malibub closed 8 months ago
Simply overwrite the color scale, like this:
library(shapviz)
library(ggplot2)
X_pred <- data.matrix(iris[, -1])
dtrain <- xgboost::xgb.DMatrix(X_pred, label = iris[, 1])
fit <- xgboost::xgb.train(data = dtrain, nrounds = 10, nthread = 1)
x <- shapviz(fit, X_pred = X_pred)
sv_importance(x, kind="bee") +
scale_colour_gradient(
low = "#005f7f",
high = "#f34c7f",
na.value = "transparent",
labels = c("low", "high"),
breaks = 0:1)
)
So changing the color options of the vivisdris package works for t
sv_importance(shp, kind = "beeswarm", viridis_args = list(begin = 0.0, end = 0.85, option = "mako"))
However, is it possible to change the colors manually using hex-codes (e.g. "#005f7f" and "#f34c7f" )?(maybe using something similar to
ggplot(data, aes(x, y, fill = value)) + geom_tile() + scale_fill_gradientn(colors = c("#005f7f", "#f34c7f"), na.value = "transparent") + theme_minimal()
but I am not sure how to include this to the sv_importance code)