# NOT RUN {
library(spinifex)
dat <- scale_sd(penguins[, 1:4])
clas <- penguins$species
bas <- basis_pca(dat)
mv <- manip_var_of(bas)
## 2D case:
mt_path <- manual_tour(bas, manip_var = mv)
ggt <- ggtour(mt_path, dat, angle = .3) +
proto_point() +
proto_basis()
# }
# NOT RUN {
animate_plotly(ggt)
# }
# NOT RUN {
## Customize basis
ggt2 <- ggtour(mt_path, dat) +
proto_basis(position = "right", manip_col = "green",
line_size = .8, text_size = 8)
# }
# NOT RUN {
animate_plotly(ggt2)
# }
# NOT RUN {
## 1D case:
bas1d <- basis_pca(dat, d = 1)
mv <- manip_var_of(bas, 3)
mt_path1d <- manual_tour(bas1d, manip_var = mv)
ggt1d <- ggtour(mt_path1d, dat, angle = .3) +
proto_density() +
proto_basis1d()
# }
# NOT RUN {
animate_plotly(ggt1d)
# }
# NOT RUN {
## Customized basis1d
ggt1d <- ggtour(mt_path1d, dat, angle = .3) +
proto_density() +
proto_basis1d(position = "bottom",
manip_col = "pink",
segment_size = 3,
text_size = 5)
# }
# NOT RUN {
animate_plotly(ggt1d)
# }
Run the code above in your browser using DataLab