Adds geom_hex() of the projected data. Does not display hexagons in plotly animations; will not work with animate_plotly().

proto_hex(
  aes_args = list(),
  identity_args = list(),
  row_index = NULL,
  bins = 30
)

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.

bins

Numeric vector giving number of bins in both vertical and horizontal directions. Defaults to 30.

Examples

library(spinifex)
raw     <- ggplot2::diamonds
dat     <- scale_sd(raw[1:10000, c(1, 5:6, 8:10)])
gt_path <- save_history(dat, grand_tour(), max = 3)

## 10000 rows is quite heavy to animate.
## Increase performance by aggregating many points into few hexagons
ggp <- ggtour(gt_path, dat) +
  proto_basis() +
  proto_hex(bins = 20)
#> Loading required namespace: hexbin

## Hexagons don't show up in plotly animation.
# \donttest{
animate_gganimate(ggp)
# }