, see ggtour
.
Performs the a manual tour and returns an animation of render_type
.
For use with tourr::save_history()
tour paths see play_tour_path()
.
play_manual_tour(
basis = NULL,
data,
manip_var,
theta = NULL,
phi_min = 0,
phi_max = 0.5 * pi,
angle = 0.05,
render_type = render_plotly,
...
)
A (p, d) orthonormal numeric matrix. The linear combination the original variables contribute to projection space. Defaults to NULL, generating a random basis.
(n, p) dataset to project, consisting of numeric variables.
Integer column number or string exact column name of the. variable to manipulate. Required, no default.
Angle in radians of "in-plane" rotation, on the xy plane of the reference frame. Defaults to theta of the basis for a radial tour.
Minimum value phi should move to. Phi is angle in radians of the "out-of-plane" rotation, the z-axis of the reference frame. Required, defaults to 0.
Maximum value phi should move to. Phi is angle in radians of the "out-of-plane" rotation, the z-axis of the reference frame. Required, defaults to pi/2.
Target distance (in radians) between steps. Defaults to .05.
Which graphics to render to. Defaults to render_plotly,
Optionally pass additional arguments to render_
and the
function used in render_type
.
An animation of a radial tour.
render_
For arguments to pass into ...
.
library(spinifex)
message("It's suggested to switch to the proto api, see `?ggtour` to get started.")
#> It's suggested to switch to the proto api, see `?ggtour` to get started.
## Setup
dat_std <- scale_sd(wine[, 2:6])
clas <- wine$Type
bas <- basis_pca(dat_std)
mv <- manip_var_of(bas)
# \donttest{
suppressWarnings(
play_manual_tour(basis = bas, data = dat_std, manip_var = mv)
)
suppressWarnings(
play_manual_tour(
basis = bas, data = dat_std, manip_var = mv,
theta = .5 * pi, axes = "right", fps = 5,
angle = .08, phi_min = 0, phi_max = 2 * pi,
aes_args = list(color = clas, shape = clas),
identity_args = list(size = 1.5, alpha = .7),
ggproto = list(ggplot2::theme_void(), ggplot2::ggtitle("My title")),
render_type = render_gganimate)
)
#> nframes and fps adjusted to match transition
## Saving output may require additional setup
if(FALSE){ ## Don't accidentally save file
## Export plotly .html widget
play_manual_tour(basis = bas, data = dat_std, manip_var = 6,
render_type = render_plotly,
html_filename = "myRadialTour.html")
## Export gganimate .gif
play_manual_tour(basis = bas, data = dat_std, manip_var = 1,
render_type = render_gganimate,
gif_filename = "myRadialTour.gif", gif_path = "./output")
}# }