View source: R/2_ggproto_visualize.r
proto_highlight | R Documentation |
A geom_point
or geom_segment
(1d case) call to draw attention to a subset
of points. This is mostly redundant proto_point
with the implementation
of the row_index
argument on data protos, still helpful in the 1d case and
for mark_initial
, does not use bkg_row_color
proto_highlight(
aes_args = list(),
identity_args = list(color = "red", size = 5, shape = 8),
row_index = 1,
mark_initial = FALSE
)
proto_highlight1d(
aes_args = list(),
identity_args = list(color = "red", linetype = 2, alpha = 0.9),
row_index = 1,
mark_initial = FALSE
)
aes_args |
A list of arguments to call inside of aes().
aesthetic mapping of the primary geom. For example,
|
identity_args |
A list of static, identity arguments passed into
|
row_index |
A numeric or logical index of rows to subset to. Defaults to 1, highlighting the first row. |
mark_initial |
Logical, whether or not to leave a fainter mark at the subset's initial position. Defaults to FALSE. |
Other ggtour proto functions:
append_fixed_y()
,
facet_wrap_tour()
,
ggtour()
,
proto_basis()
,
proto_default()
,
proto_density()
,
proto_density2d()
,
proto_hex()
,
proto_hline0()
,
proto_origin()
,
proto_point()
,
proto_text()
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)
## d = 2 case
ggt <- ggtour(gt_path, dat, angle = .3) +
proto_default(aes_args = list(color = clas, shape = clas)) +
proto_highlight(row_index = 5)
animate_plotly(ggt)
## Highlight multiple observations
ggt2 <- ggtour(gt_path, dat, angle = .3) +
proto_default(aes_args = list(color = clas, shape = clas)) +
proto_highlight(row_index = c( 2, 6, 19),
identity_args = list(color = "blue", size = 4, shape = 4))
animate_plotly(ggt2)
## 1D case:
gt_path1d <- save_history(dat, grand_tour(d = 1), max_bases = 3)
ggt <- ggtour(gt_path1d, dat, angle = .3) +
proto_default1d(aes_args = list(fill = clas, color = clas)) +
proto_highlight1d(row_index = 7)
animate_plotly(ggt)
## Highlight multiple observations, mark_initial defaults to off
ggt2 <- ggtour(gt_path1d, dat, angle = .3) +
proto_default1d(aes_args = list(fill = clas, color = clas)) +
proto_highlight1d(row_index = c(2, 6, 7),
identity_args = list(color = "green", linetype = 1))
animate_plotly(ggt2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.