print.ggvis {ggvis} | R Documentation |
View in a ggvis plot in the browser.
Description
view_static
creates a static web page in a temporary directory;
view_dynamic
generate a dynamic shiny app and launches it.
print
automatically picks between the two.
Usage
## S3 method for class 'ggvis'
print(x, dynamic = NA, launch = interactive(), ...)
view_static(x, plot_id = rand_id("plot_"), dest = NULL)
view_dynamic(x, plot_id = rand_id("plot_"), port = NULL, quiet = FALSE)
Arguments
x |
A ggvis object. |
dynamic |
Uses |
launch |
If |
... |
Other arguments passed on to |
plot_id |
Unique identifier used to identify the plot on the page. |
dest |
Deprecated (this no longer works). |
port |
the port on which to start the shiny app. If NULL (the default), Shiny will select a random port. |
quiet |
If |
Details
If view_static
is used on a ggvis object that has dynamic components,
it will output a static plot.
Examples
## Run these examples only in interactive R sessions
if (interactive()) {
# In most cases view_static is unnecessary; these will do the same thing:
mtcars %>% ggvis(~wt, ~mpg)
mtcars %>% ggvis(~wt, ~mpg) %>% view_static()
# Can find the output file with view_static() and html_print()
outfile <- mtcars %>% ggvis(~wt, ~mpg) %>%
view_static() %>% htmltools::html_print(viewer = NULL)
}