plot.light_effects: Visualize Multiple Types of Profiles Together

View source: R/plot_light_effects.R

plot.light_effectsR Documentation

Visualize Multiple Types of Profiles Together

Description

Visualizes response-, prediction-, partial dependence, and/or ALE profiles of a (multi-)flashlight with respect to a covariable v. Different flashlights or a single flashlight with one "by" variable are separated by a facet wrap.

Usage

## S3 method for class 'light_effects'
plot(
  x,
  use = c("response", "predicted", "pd"),
  zero_counts = TRUE,
  size_factor = 1,
  facet_scales = "free_x",
  facet_nrow = 1L,
  rotate_x = TRUE,
  show_points = TRUE,
  ...
)

Arguments

x

An object of class "light_effects".

use

A vector of elements to show. Any subset of ("response", "predicted", "pd", "ale") or "all". Defaults to all except "ale"

zero_counts

Logical flag if 0 count levels should be shown on the x axis.

size_factor

Factor used to enlarge default size/linewidth in ggplot2::geom_point() and ggplot2::geom_line().

facet_scales

Scales argument passed to ggplot2::facet_wrap().

facet_nrow

Number of rows in ggplot2::facet_wrap(). Must be 1 if plot_counts() should be used.

rotate_x

Should x axis labels be rotated by 45 degrees?

show_points

Should points be added to the line (default is TRUE).

...

Further arguments passed to geoms.

Value

An object of class "ggplot".

See Also

light_effects(), plot_counts()

Examples

fit <- lm(Sepal.Length ~ ., data = iris)
fl <- flashlight(model = fit, label = "iris", data = iris, y = "Sepal.Length")
plot(light_effects(fl, v = "Species"))

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