View source: R/figureCaption.R
figureCaption | R Documentation |
this function adds a caption to an existing plot object
(either lattice or ggplot2). strwrap
is used to automatically wrap text at column 75. Clipping is off,
so long text will continue downward outside the plotting region.
Keep this in mind when setting the height of your graphics device.
figureCaption(obj, txt, width = 75L, ...)
obj |
the lattice or ggplot2 object to which the caption should be added |
txt |
the cpation text |
width |
target column for wrapping lines, see |
... |
additional parameters passed on to |
Tim Appelhans
## lattice example
library(lattice)
p1 <- levelplot(volcano)
txt <- "Fig 1.: Elevation of Maunga Whau (Mt Eden) volcano in Auckland.
Axes are standardised values."
figureCaption(p1, txt)
## change font size
figureCaption(p1, txt, fontsize = 12)
## ggplot2 example
library(ggplot2)
p2 <- qplot(1:10, rnorm(10), colour = runif(10))
figureCaption(p2, "Fig. 2: Some color coded random numbers.",
fontface = "italic")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.