plot.light_profile2d: Visualize 2D-Profiles, e.g., of Partial Dependence

View source: R/plot_light_profile2d.R

plot.light_profile2dR Documentation

Visualize 2D-Profiles, e.g., of Partial Dependence

Description

Minimal visualization of an object of class "light_profile2d". The object returned is of class "ggplot" and can be further customized.

Usage

## S3 method for class 'light_profile2d'
plot(x, swap_dim = FALSE, rotate_x = TRUE, numeric_as_factor = FALSE, ...)

Arguments

x

An object of class "light_profile2d".

swap_dim

Swap the ggplot2::facet_grid() dimensions.

rotate_x

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

numeric_as_factor

Should numeric x and y values be converted to factors first? Default is FALSE. Useful if cut_type was not set to "equal".

...

Further arguments passed to ggplot2::geom_tile().

Details

The main geometry is ggplot2::geom_tile(). Additional dimensions ("by" variable(s) and/or multiflashlight) are represented by facet_wrap/grid. For all types of profiles except "partial dependence", it is natural to see empty parts in the plot. These are combinations of the v variables that do not appear in the data. Even for type "partial dependence", such gaps can occur, e.g. for cut_type = "quantile" or if n_bins are larger than the number of distinct values of a v variable. Such gaps can be suppressed by setting numeric_as_factor = TRUE or by using the arguments breaks, pd_evaluate_at or pd_grid in light_profile2d().

Value

An object of class "ggplot".

See Also

light_profile2d()

Examples

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

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