Plot Output — renderPlot
renderPlot(expr, width = "auto", height = "auto", res = 72, ..., 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 |
env |
The environment in which to evaluate |
quoted |
Is |
execOnResize |
If |
outputArgs |
A list of arguments to be passed through to the implicit
call to |
Description
Renders a reactive plot that is suitable for assigning to an output
slot.
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.