shiny (version 0.13.0)

renderPlot: Plot Output

Description

Renders a reactive plot that is suitable for assigning to an output slot.

Usage

renderPlot(expr, width = "auto", height = "auto", res = 72, ...,
  env = parent.frame(), quoted = FALSE, func = NULL)

Arguments

expr
An expression that generates a plot.
width, height
The width/height of the rendered plot, in pixels; or 'auto' to use the offsetWidth/offsetHeight of the HTML element that is bound to this plot. You can also pass in a function that returns the width/height in pixels
res
Resolution of resulting plot, in pixels per inch. This value is passed to png. Note that this affects the resolution of PNG rendering in R; it won't change the actual ppi of the browser.
...
Arguments to be passed through to png. These can be used to set the width, height, background color, etc.
env
The environment in which to evaluate expr.
quoted
Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.
func
A function that generates a plot (deprecated; use expr instead).

Interactive plots

With ggplot2 graphics, the code in renderPlot should return a ggplot object; if instead the code prints the ggplot2 object with something like print(p), then the coordinates for interactive graphics will not be properly scaled to the data space.

See plotOutput for more information about interactive plots.

Details

The corresponding HTML output tag should be div or img and have the CSS class name shiny-plot-output.

See Also

For the corresponding client-side output function, and example usage, see plotOutput. For more details on how the plots are generated, and how to control the output, see plotPNG.