View source: R/2_ggproto_visualize.r
| facet_wrap_tour | R Documentation |
Create and wrap a 1d ribbon of panels in 2d.
Because of the side effects of ggtour and facet_wrap_tour this wants to be
applied after ggtour and before any proto_* functions.
plotly may not display well with with faceting.
facet_wrap_tour(facet_var, nrow = NULL, ncol = NULL, dir = "h")
facet_var |
Expects a single variable to facet the levels of.
Should be a vector, not a formula ( |
nrow |
Number of rows. Defaults to NULL; set by display dim. |
ncol |
Number of columns. Defaults to NULL; set by display dim. |
dir |
Direction of wrapping: either "h" horizontal by rows, or "v", for vertical by columns. Defaults to "h". |
Other ggtour proto functions:
append_fixed_y(),
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)
mt_path <- manual_tour(bas, manip_var = mv)
## d = 2 case
message("facet_wrap_tour wants be called early, so that other proto's adopt the facet_var.")
ggt <- ggtour(mt_path, dat, angle = .3) +
facet_wrap_tour(facet_var = clas, ncol = 2, nrow = 2) +
proto_default(aes_args = list(color = clas, shape = clas),
identity_args = list(size = 1.5))
## Not run:
animate_gganimate(ggt) ## May not always play well with plotly
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.