proto_point: Tour proto for data point

View source: R/2_ggproto_visualize.r

proto_pointR Documentation

Tour proto for data point

Description

Adds geom_point() of the projected data.

Usage

proto_point(
  aes_args = list(),
  identity_args = list(alpha = 0.9),
  row_index = NULL,
  bkg_color = "grey80"
)

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.

bkg_color

The character color by name or hexadecimal to display background observations, those not in the row_index. Defaults to "grey80". Use FALSE or NULL to skip rendering background points. Other aesthetic values such as shape and alpha are set adopted from aes_args and identity_args.

See Also

Other ggtour proto functions: append_fixed_y(), facet_wrap_tour(), ggtour(), proto_basis(), proto_default(), proto_density2d(), proto_density(), proto_hex(), proto_highlight(), proto_hline0(), proto_origin(), proto_text()

Examples

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

ggt <- ggtour(gt_path, dat, angle = .3) +
  proto_point(aes_args = list(color = clas, shape = clas),
              identity_args = list(size = 2, alpha = .7))

animate_plotly(ggt)


## Select/highlight observations with `row_index`
ggt <- ggtour(gt_path, dat, angle = .3) +
  proto_point(aes_args = list(color = clas, shape = clas),
              identity_args = list(size = 2, alpha = .7),
              row_index = which(clas == levels(clas)[1]),
              bkg_color = "grey80") ## FALSE or NULL to skip plotting background

animate_plotly(ggt)


spinifex documentation built on March 31, 2022, 9:06 a.m.