plot.light_performance: Visualize Model Performance

View source: R/plot_light_performance.R

plot.light_performanceR Documentation

Visualize Model Performance

Description

Minimal visualization of an object of class "light_performance" as ggplot2::geom_bar(). The object returned has class "ggplot", and can be further customized.

Usage

## S3 method for class 'light_performance'
plot(
  x,
  swap_dim = FALSE,
  geom = c("bar", "point"),
  facet_scales = "free_y",
  rotate_x = FALSE,
  ...
)

Arguments

x

An object of class "light_performance".

swap_dim

Should representation of dimensions (either two "by" variables or one "by" variable and multiflashlight) of x aesthetic and dodge fill aesthetic be swapped? Default is FALSE.

geom

Geometry of plot (either "bar" or "point")

facet_scales

Scales argument passed to ggplot2::facet_wrap().

rotate_x

Should x axis labels be rotated by 45 degrees?

...

Further arguments passed to ggplot2::geom_bar() or ggplot2::geom_point().

Details

The plot is organized as a bar plot as follows: For flashlights without "by" variable specified, a single bar is drawn. Otherwise, the "by" variable (or the flashlight label if there is no "by" variable) is represented by the "x" aesthetic.

The flashlight label (in case of one "by" variable) is represented by dodged bars. This strategy makes sure that performance of different flashlights can be compared easiest. Set "swap_dim = TRUE" to revert the role of dodging and x aesthetic. Different metrics are always represented by facets.

Value

An object of class "ggplot".

See Also

light_performance()

Examples

fit <- lm(Sepal.Length ~ ., data = iris)
fl <- flashlight(model = fit, label = "ols", data = iris, y = "Sepal.Length")
plot(light_performance(fl, by = "Species"), fill = "darkred")

flashlight documentation built on May 31, 2023, 6:19 p.m.