File: staticPlot.Rd

package info (click to toggle)
r-cran-manipulatewidgets 0.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,796 kB
  • sloc: javascript: 337; makefile: 2
file content (54 lines) | stat: -rw-r--r-- 1,612 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/static_image.R
\name{staticPlot}
\alias{staticPlot}
\alias{staticImage}
\title{Include a static image in a combinedWidgets}
\usage{
staticPlot(expr, width = 600, height = 400)

staticImage(file, style = "max-width:100\%\%;max-height:100\%\%")
}
\arguments{
\item{expr}{Expression that creates a static plot.}

\item{width}{Width of the image to create.}

\item{height}{Height of the image to create.}

\item{file}{path of the image to include.}

\item{style}{CSS style to apply to the image.}
}
\value{
a \code{shiny.tag} object containing the HTML code required to include
the image or the plot in a \code{combinedWidgets} object.
}
\description{
\code{staticPlot} is a function that generates a static plot and then return
the HTML code needed to include the plot in a combinedWidgets.
\code{staticImage} is a more general function that generates the HTML code
necessary to include any image file.
}
\examples{
staticPlot(hist(rnorm(100)))

if (require(plotly)) {
  data(iris)

  combineWidgets(
    plot_ly(iris, x = ~Sepal.Length, type = "histogram", nbinsx = 20),
    staticPlot(hist(iris$Sepal.Length, breaks = 20), height = 300)
  )

  # You can also embed static images in the header, footer, left or right
  # columns of a combinedWidgets. The advantage is that the space allocated
  # to the static plot will be constant when the window is resized.

  combineWidgets(
    plot_ly(iris, x = ~Sepal.Length, type = "histogram", nbinsx = 20),
    footer = staticPlot(hist(iris$Sepal.Length, breaks = 20), height = 300)
  )
}

}