View source: R/plot_light_breakdown.R
plot.light_breakdown | R Documentation |
Minimal visualization of an object of class "light_breakdown" as waterfall plot. The object returned is of class "ggplot" and can be further customized.
## S3 method for class 'light_breakdown'
plot(x, facet_scales = "free", facet_ncol = 1, rotate_x = FALSE, ...)
x |
An object of class "light_breakdown". |
facet_scales |
Scales argument passed to |
facet_ncol |
|
rotate_x |
Should x axis labels be rotated by 45 degrees? |
... |
Further arguments passed to |
The waterfall plot is to be read from top to bottom. The first line describes the (weighted) average prediction in the query data used to start with. Then, each additional line shows how the prediction changes due to the impact of the corresponding variable. The last line finally shows the original prediction of the selected observation. Multiple flashlights are shown in different facets. Positive and negative impacts are visualized with different colors.
An object of class "ggplot".
light_breakdown()
fit <- lm(Sepal.Length ~ . + Petal.Length:Species, data = iris)
fl <- flashlight(model = fit, label = "lm", data = iris, y = "Sepal.Length")
plot(light_breakdown(fl, new_obs = iris[1, ]))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.