Adds geom_density() and geom_rug() of the projected data. Density postion = "stack" does not work with animate_plotly(), GH issue is open.

proto_density(
  aes_args = list(),
  identity_args = list(alpha = 0.7),
  row_index = NULL,
  density_position = c("identity", "stack", "fill"),
  rug_shape = c(3, 142, 124, NULL)
)

Arguments

aes_args

A list of arguments to call inside of aes(). aesthetic mapping of the primary geom. For example, geom_point(aes(color = my_fct, shape = my_fct)) becomes aes_args = list(color = my_fct, shape = my_fct).

identity_args

A list of static, identity arguments passed into the primary geom. For instance, geom_point(size = 2, alpha = .7) becomes identity_args = list(size = 2, alpha = .7). Also passes more foundational arguments such as stat and position, though these have been tested less.

row_index

A numeric or logical index of rows to subset to. Defaults to NULL, all observations.

density_position

The ggplot2 position of geom_density(). Either c("identity", "stack"), defaults to "identity". Warning: "stack" does not work with animate_plotly() at the moment.

rug_shape

Numeric, the number of the shape to make rug marks. Expects either 3 142, 124 or NULL, '+', '|' (plotly), '|' (ggplot2) respectively. Defaults to 3.

Examples

library(spinifex)
dat     <- scale_sd(penguins_na.rm[, 1:4])
clas    <- penguins_na.rm$species
gt_path <- save_history(dat, grand_tour(), max = 3)

ggt <- ggtour(gt_path, dat, angle = .3) +
  proto_density(aes_args = list(color = clas, fill = clas)) +
  proto_basis1d() +
  proto_origin1d()
# \donttest{
animate_plotly(ggt)
# }