ggvis (version 0.4.3)

print.ggvis: 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 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 view_dynamic if TRUE, view_static if FALSE. The default, NA, chooses automatically based on the presence of reactives or interactive inputs in x.

launch

If TRUE, will launch plot in a viewer/browser. If FALSE returns an object that you can print() to launch.

...

Other arguments passed on to view_dynamic and view_static ?from print.

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 TRUE show status messages from Shiny. (Default is FALSE.)

Details

If view_static is used on a ggvis object that has dynamic components, it will output a static plot.

Examples

Run this code
# NOT RUN {
# 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)
# }

Run the code above in your browser using DataCamp Workspace