proto_highlight: Tour proto highlighing specified points

Description Usage Arguments See Also Examples

View source: R/2_ggproto_visualize.r

Description

A geom_point or geom_segment(*1d) call to draw attention to a subset of points. Subset the projected data frames to the specified rownum_index of the original data.frame with specified highlighting aesthetics. The order you apply highlighting is import when using with other proto_* functions.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
proto_highlight(
  rownum_index,
  aes_args = list(),
  identity_args = list(color = "red", size = 5, shape = 8),
  mark_initial = if (length(rownum_index) == 1) TRUE else FALSE
)

proto_highlight1d(
  rownum_index,
  aes_args = list(),
  identity_args = list(color = "red", linetype = 2, alpha = 0.9),
  mark_initial = if (length(rownum_index) == 1) TRUE else FALSE
)

Arguments

rownum_index

One or more integers, the row numbers of the to highlight. Should be within 1:n, the rows of the original data.

aes_args

A list of aesthetic arguments to passed to geom_point(aes(X). Any mapping of the data to an aesthetic, for example, geom_point(aes(color = myCol, shape = myCol)) becomes aes_args = list(color = myCol, shape = myCol).

identity_args

A list of static, identity arguments passed into geom_point(), but outside of aes(), for instance geom_point(aes(...), size = 2, alpha = .7) becomes identity_args = list(size = 2, alpha = .7). Typically a single numeric for point size, alpha, or similar.

mark_initial

Logical, whether or not to leave a fainter mark at the subset's initial position. By default: TRUE if single row number given else FALSE.

See Also

Other ggtour proto: filmstrip(), ggtour(), proto_basis(), proto_default(), proto_density(), proto_hex(), proto_origin(), proto_point(), proto_text()

Other ggtour proto: filmstrip(), ggtour(), proto_basis(), proto_default(), proto_density(), proto_hex(), proto_origin(), proto_point(), proto_text()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
dat <- scale_sd(tourr::flea[, 1:6])
clas <- tourr::flea$species
gt_path <- tourr::save_history(dat, grand_tour(), max_bases = 5)

## d = 2 case, Highlighting 1 obs defaults mark_initial to TRUE.
ggt <- ggtour(gt_path, dat) +
  proto_highlight(rownum_index = 5) +
  proto_point()
## Not run: 
animate_plotly(ggt)
## End(Not run)

## Custom aesthetics. Highlighting multiple points defaults mark_initial to FALSE
ggt2 <- ggtour(gt_path, dat) +
  proto_highlight(rownum_index = c( 2, 6, 19),
                  identity_args = list(color = "blue", size = 4, shape = 2)) +
  proto_point(list(color = clas, shape = clas),
              list(size = 2, alpha = .7))
## Not run: 
animate_plotly(ggt2)
## End(Not run)
## 1D case:
gt_path <- tourr::save_history(dat, grand_tour(d = 1), max_bases = 3)

ggt <- ggtour(gt_path, dat) +
  proto_default1d(list(fill = clas, color = clas)) +
  proto_highlight1d(rownum_index = 7)
## Not run: 
animate_plotly(ggt)
## End(Not run)

ggt2 <- ggtour(gt_path, dat) +
  proto_default1d(list(fill = clas, color = clas)) +
  proto_highlight1d(rownum_index = c(2, 6, 7))
## Not run: 
animate_plotly(ggt2)
## End(Not run)

spinifex documentation built on Sept. 28, 2021, 5:09 p.m.