Learn R Programming

flashlight (version 0.8.0)

plot.light_scatter: Scatter Plot

Description

Values are plotted against a variable. The object returned is of class ggplot and can be further customized. To avoid overplotting, pass e.g. alpha = 0.2 or position = "jitter".

Usage

# S3 method for light_scatter
plot(x, swap_dim = FALSE, facet_scales = "free_x", rotate_x = FALSE, ...)

Value

An object of class ggplot2.

Arguments

x

An object of class light_scatter.

swap_dim

If multiflashlight and one "by" variable or single flashlight with two "by" variables, swap the role of color variable and facet variable. If multiflashlight or one "by" variable, use colors instead of facets.

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_point. Typical arguments would be alpha = 0.2 or position = "jitter" to avoid overplotting.

See Also

light_scatter.

Examples

Run this code
fit_a <- lm(Sepal.Length ~ . -Petal.Length, data = iris)
fit_b <- lm(Sepal.Length ~ ., data = iris)
fl_a <- flashlight(model = fit_a, label = "without Petal.Length")
fl_b <- flashlight(model = fit_b, label = "all")
fls <- multiflashlight(list(fl_a, fl_b), data = iris, y = "Sepal.Length")
pr <- light_scatter(fls, v = "Petal.Length")
plot(pr, alpha = 0.2)
plot(light_scatter(fls, "Petal.Length", by = "Species"), alpha = 0.2)

Run the code above in your browser using DataLab