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))
# \donttest{
animate_gganimate(ggt)
# }
## 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)
# \donttest{
animate_gganimate(ggt2)
# }
Run the code above in your browser using DataLab