| plt {cwhplot} | R Documentation |
- plt executes a (series of) plotting function(s) depending on a
switch, may be useful in source.
- plotTitStamp creates an array of plot panels and executes a
(series of) plotting function(s) and adds a title and a time stamp to the overall plot.
- pltTSV is a shortcut for plt(VIEW,plotTitStamp(...),file,horizontal)
- pltCharMat uses output from charMat to plot numerical matrices as characters
plt(VIEW,f,file="",horizontal = FALSE)
plotTitStamp(rows, cols, tit, stampl, f=function(x) 0,
cex=1.5,reset=TRUE,outer=TRUE,oma=c(2,2,4,2),mar=c(4,4,2,1))
pltTSV(VIEW="see", rows, cols, tit, stampl, f=function(x) 0,
cex=1.5,reset=TRUE,outer=TRUE,oma=c(2,2,4,2),mar=c(4,4,2,1),file=stampl,horizontal=TRUE)
pltCharMat(m,tit)
VIEW |
"NA" or NA, nothing will be done. "see", the plot will be created in the active plot window. "eps", the plot will be saved to file "<file>.eps" "ps", the plot will be created in a postscript file "<file>.ps". "ps+p", like with "ps", the file will also be printed. "pdf", the plot will be created in a pdf file "<file>.pdf" |
f |
A function to plot the individual plot panels. It can also be a statement sequence {...} |
file |
Name of file to write to. |
horizontal |
Landscape, if TRUE. |
rows |
Number of rows of panels. |
cols |
Number of columns of panels. |
tit |
Overall title for plot. A vector of one or two elements. If
an element is an expression, plotmath will be used |
stampl |
Label for time stamp. |
cex |
Font size used for tit. |
reset |
Should previous rows, cols be restored after execution. |
outer |
Passed on to mtext. |
oma |
Outer margin used in initial par(...). |
mar |
Lines of margin used in initial par(...). |
m |
numerical matrix |
Are called for their side effect to produce a plot and/or generate a file.
The sequence of functions contained in f MUST NOT contain any call to
postscript, because this would try to open another ps device without closing the old one!
oldpar <- par(mfrow = c(rows, cols),oma=oma,mar=mar) is called at the
beginning of pltTitStamp. Uses
datetime, [lattice:extend.limits]{extend.limits}.
If you have n panels you want to plot in a nearly quadratic arrangement, use rows = round(sqrt(n)), cols=ceiling(n/rows) (tending to slightly "landscape"). This is very similar to n2mfrow.
Christian W. Hoffmann, christian.hoffmann@wsl.ch, http://www.wsl.ch/staff/christian.hoffmann
# see also this-is-escaped-code{
x <- rnorm(100); y <- rnorm(100)+1; z <- y+rlnorm(100)
plt("see", {plot(x,y,xlab="this is my x");abline(reg=lm(y~x),lty=2);plot(x,z,pch=3)})
## Not run: plt("ps", plot(y,x-3*y) )
## Not run: plt("ps+p", plot(y,x-3*y) )
## Not run:
plotTitStamp(1, 2, "1 by 2 plot", "Example 1", {plot(x,y,xlab="my x");
abline(reg=lm(y~x),lty=2);plot(x,z,pch=3)})
## End(Not run)
## Not run: plotTitStamp(1, 1, "1 by 2 plot", "Ex2", plot(y,x-3*y) )
m <- matrix(rnorm(500),nrow=50,ncol=10)
pltCharMat(m,"Random example")