Learn R Programming

flashlight (version 0.7.5)

plot.light_ice: Visualize ICE profiles

Description

Minimal visualization of an object of class light_ice as geom_line. The object returned is of class ggplot and can be further customized.

Usage

# S3 method for light_ice
plot(x, facet_scales = "fixed", rotate_x = FALSE, ...)

Arguments

x

An object of class light_ice.

facet_scales

Scales argument passed to facet_wrap.

rotate_x

Should x axis labels be rotated by 45 degrees? Default is FALSE.

...

Further arguments passed to geom_line.

Value

An object of class ggplot2.

Details

Each observation is visualized by a line. The first "by" variable is represented by the color, a second "by" variable or a multiflashlight by facets.

See Also

light_ice.

Examples

Run this code
# NOT RUN {
fit_full <- lm(Sepal.Length ~ ., data = iris)
fit_part <- lm(Sepal.Length ~ Petal.Length, data = iris)
mod_full <- flashlight(model = fit_full, label = "full", data = iris, y = "Sepal.Length")
mod_part <- flashlight(model = fit_part, label = "part", data = iris, y = "Sepal.Length")
mods <- multiflashlight(list(mod_full, mod_part))
plot(light_ice(mod_full, v = "Species"), alpha = 0.2)
indices <- (1:15) * 10
plot(light_ice(mods, v = "Species", indices = indices))
plot(light_ice(mods, v = "Species", indices = indices, center = "first"))
plot(light_ice(mods, v = "Petal.Width", by = "Species", n_bins = 5, indices = indices))
# }

Run the code above in your browser using DataLab