| renderPlot {shiny} | R Documentation |
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,
...,
alt = NA,
env = parent.frame(),
quoted = FALSE,
execOnResize = FALSE,
outputArgs = list()
)
Arguments
expr |
An expression that generates a plot. |
width, height |
Height and width can be specified in three ways:
When rendering an inline plot, you must provide numeric values (in pixels)
to both |
res |
Resolution of resulting plot, in pixels per inch. This value is
passed to |
... |
Arguments to be passed through to |
alt |
Alternate text for the HTML |
env |
The parent environment for the reactive expression. By default,
this is the calling environment, the same as when defining an ordinary
non-reactive expression. If |
quoted |
If it is |
execOnResize |
If |
outputArgs |
A list of arguments to be passed through to the implicit
call to |
Details
The corresponding HTML output tag should be div or img and have
the CSS class name shiny-plot-output.
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.
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().
renderCachedPlot() offers a way to cache generated plots to
expedite the rendering of identical plots.