mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Add info about printing ggplot objects
This commit is contained in:
@@ -872,10 +872,16 @@ imageOutput <- function(outputId, width = "100%", height="400px",
|
||||
#' \code{brush}.
|
||||
#'
|
||||
#' For \code{plotOutput}, the coordinates will be sent scaled to the data
|
||||
#' space, if possible. (At the moment, plots generated by base graphics
|
||||
#' support this scaling, although plots generated by grid or ggplot2 do not.)
|
||||
#' If scaling is not possible, the raw pixel coordinates will be sent. For
|
||||
#' \code{imageOutput}, the coordinates will be sent in raw pixel coordinates.
|
||||
#' space, if possible. (At the moment, plots generated by base graphics and
|
||||
#' ggplot2 support this scaling, although plots generated by lattice and
|
||||
#' others do not.) If scaling is not possible, the raw pixel coordinates will
|
||||
#' be sent. For \code{imageOutput}, the coordinates will be sent in raw pixel
|
||||
#' coordinates.
|
||||
#'
|
||||
#' With ggplot2 graphics, the code in \code{renderPlot} should return a ggplot
|
||||
#' object; if instead the code prints the ggplot2 object with something like
|
||||
#' \code{print(p)}, then the coordinates for interactive graphics will not be
|
||||
#' properly scaled to the data space.
|
||||
#'
|
||||
#' @param outputId output variable to read the plot/image from.
|
||||
#' @param width,height Image width/height. Must be a valid CSS unit (like
|
||||
@@ -889,8 +895,8 @@ imageOutput <- function(outputId, width = "100%", height="400px",
|
||||
#' created by the \code{\link{clickOpts}} function. If you use a value like
|
||||
#' \code{"plot_click"} (or equivalently, \code{clickOpts(id="plot_click")}),
|
||||
#' the plot will send coordinates to the server whenever it is clicked, and
|
||||
#' the value will be accessible via \code{input$plot_click}. The value will
|
||||
#' be a named list with \code{x} and \code{y} elements indicating the mouse
|
||||
#' the value will be accessible via \code{input$plot_click}. The value will be
|
||||
#' a named list with \code{x} and \code{y} elements indicating the mouse
|
||||
#' position.
|
||||
#' @param dblclick This is just like the \code{click} argument, but for
|
||||
#' double-click events.
|
||||
|
||||
@@ -30,8 +30,8 @@ because of how height is computed with HTML/CSS.}
|
||||
created by the \code{\link{clickOpts}} function. If you use a value like
|
||||
\code{"plot_click"} (or equivalently, \code{clickOpts(id="plot_click")}),
|
||||
the plot will send coordinates to the server whenever it is clicked, and
|
||||
the value will be accessible via \code{input$plot_click}. The value will
|
||||
be a named list with \code{x} and \code{y} elements indicating the mouse
|
||||
the value will be accessible via \code{input$plot_click}. The value will be
|
||||
a named list with \code{x} and \code{y} elements indicating the mouse
|
||||
position.}
|
||||
|
||||
\item{dblclick}{This is just like the \code{click} argument, but for
|
||||
@@ -97,10 +97,16 @@ The arguments \code{clickId} and \code{hoverId} only work for R base
|
||||
\code{brush}.
|
||||
|
||||
For \code{plotOutput}, the coordinates will be sent scaled to the data
|
||||
space, if possible. (At the moment, plots generated by base graphics
|
||||
support this scaling, although plots generated by grid or ggplot2 do not.)
|
||||
If scaling is not possible, the raw pixel coordinates will be sent. For
|
||||
\code{imageOutput}, the coordinates will be sent in raw pixel coordinates.
|
||||
space, if possible. (At the moment, plots generated by base graphics and
|
||||
ggplot2 support this scaling, although plots generated by lattice and
|
||||
others do not.) If scaling is not possible, the raw pixel coordinates will
|
||||
be sent. For \code{imageOutput}, the coordinates will be sent in raw pixel
|
||||
coordinates.
|
||||
|
||||
With ggplot2 graphics, the code in \code{renderPlot} should return a ggplot
|
||||
object; if instead the code prints the ggplot2 object with something like
|
||||
\code{print(p)}, then the coordinates for interactive graphics will not be
|
||||
properly scaled to the data space.
|
||||
}
|
||||
\examples{
|
||||
# Only run these examples in interactive R sessions
|
||||
|
||||
Reference in New Issue
Block a user