Plot method for objects of class "partial_dep". Can do (grouped) line plots or heatmaps.

# S3 method for class 'partial_dep'
plot(
  x,
  color = getOption("hstats.color"),
  swap_dim = FALSE,
  viridis_args = getOption("hstats.viridis_args"),
  facet_scales = "fixed",
  rotate_x = FALSE,
  show_points = TRUE,
  d2_geom = c("tile", "point", "line"),
  ...
)

Arguments

x

An object of class "partial_dep".

color

Color of lines and points (in case there is no color/fill aesthetic). The default equals the global option hstats.color = "#3b528b". To change the global option, use options(stats.color = new value).

swap_dim

Switches the role of grouping and facetting (default is FALSE). Exception: For the 2D PDP with d2_geom = "line", it swaps the role of the two variables in v.

viridis_args

List of viridis color scale arguments, see [ggplot2::scale_color_viridis_d()]. The default points to the global option hstats.viridis_args, which corresponds to list(begin = 0.2, end = 0.8, option = "B"). E.g., to switch to a standard viridis scale, you can change the default via options(hstats.viridis_args = list()), or set viridis_args = list().

facet_scales

Value passed as scales argument to [ggplot2::facet_wrap()].

rotate_x

Should x axis labels be rotated by 45 degrees?

show_points

Logical flag indicating whether to show points (default) or not. No effect for 2D PDPs.

d2_geom

The geometry used for 2D PDPs, by default "tile". Option "point" is useful, e.g., when the grid represents spatial points. Option "line" produces lines grouped by the second variable.

...

Arguments passed to geometries.

Value

An object of class "ggplot".

See also

See partial_dep() for examples.