cardoonPlot: cardoonPlot

Description Usage Arguments Value Examples

Description

Take a plot expression or object and turn it into a base64 encoded png string for embedding in a browser

Usage

1
2
cardoonPlot(plotObj, type = c("png", "pdf"), width = 480, height = 480,
  res = 72, ...)

Arguments

plotObj

a lattice or ggplot object, or an expression of R base plotting commands

type

the type of plot to create (currently png or pdf)

width

width of plot, in pixels

height

width of plot, in pixels

res

nominal resolution in ppi which will be recorded in the file, if a positive integer

...

arguments passed to png or pdf

Value

a base64 encoded png string

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
cardoonPlot(expression(plot(1:10)))
myPlotExpr <- expression({
   plot(1:10)
   abline(0, 1)
})
cardoonPlot(myPlotExpr)

# passing additional arguments to png
cardoonPlot(expression(plot(1:10)),
   width = 800, height = 400, res = 150)

# using lattice:
cardoonPlot(xyplot(rnorm(10) ~ rnorm(10)))
# pass lattice object
p <- dotplot(variety ~ yield | year * site, data=barley)
cardoonPlot(p)

# using ggplot
cardoonPlot(qplot(mpg, wt, data = mtcars))
# pass ggplot object
p <- qplot(mpg, wt, data = mtcars)
cardoonPlot(p)

hafen/cardoonTools documentation built on May 17, 2019, 1:32 p.m.