View source: R/2_ggproto_visualize.r
| proto_text_repel | R Documentation |
Adds ggrepel::geom_text_repel() of the projected data.
proto_text_repel(
aes_args = list(vjust = "outward", hjust = "outward"),
identity_args = list(nudge_x = 0.05),
row_index = NULL
)
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
the primary geom. For instance,
|
row_index |
A numeric or logical index of rows to subset to. Defaults to NULL, all observations. |
Other ggtour proto functions:
append_fixed_y(),
facet_wrap_tour(),
ggtour(),
proto_basis(),
proto_default(),
proto_density(),
proto_density2d(),
proto_hex(),
proto_highlight(),
proto_hline0(),
proto_origin(),
proto_point(),
proto_text()
library(spinifex)
dat <- scale_sd(penguins_na.rm[, 1:4])
clas <- penguins_na.rm$species
bas <- basis_pca(dat)
mv <- manip_var_of(bas)
gt_path <- save_history(dat, grand_tour(), max_bases = 5)
ggt <- ggtour(gt_path, dat, angle = .2) +
proto_text_repel(list(color = clas)) +
proto_point(list(color = clas, shape = clas),
list(size = 1))
## Not run:
animate_gganimate(ggt)
## End(Not run)
## Custom labels, subset of points
dat <- mtcars[c("mpg", "disp", "hp", "drat", "wt")]
clas <- as.factor(mtcars$cyl)
bas <- basis_olda(dat, clas)
lab <- abbreviate(rownames(mtcars))
gt_path <- save_history(dat, grand_tour(), max_bases = 3)
ggt2 <- ggtour(gt_path, dat) +
proto_text_repel(list(color = clas, label = lab),
list(size = 1),
row_index = 1:30) +
proto_point(list(color = clas, shape = clas),
list(size = 1),
row_index = 1:30)
## Not run:
animate_gganimate(ggt2)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.