plt: Plot depending on switch, Create multiple plots with title...

Description Usage Arguments Value WARNING Note Author(s) Examples

Description

- pltCharMat uses output from charMat to plot numerical matrices as characters. - pltRCT executes a (series of) plotting function(s) under the control of some useful switches, may be useful in source. - histRCT creates a (series of) histogram(s), uses pltRCT. - SplomT creates a scatterplot matrix with a) covariances (with script size proportional to size) in the upper triangle, b) histograms (with smoothing) and variable names in the diagonal, and c) scatterplot with smoothes in y and x direction in the lower triangle, stressing high correlations by nearly parallel lines. See figure in other documentation.

Usage

1
2
3
4
5
6
pltCharMat(m,...)
pltRCT(rows, cols, tit="", f = function(x) 0, cex = 1.5, 
    reset = TRUE, outer = TRUE, oma = c(2, 2, 4, 2), mar = c(4, 4, 2, 1))
histRCT(data, rows = round(sqrt(ncol(data))), 
    cols = ceiling(ncol(data)/rows), breaks = "Sturges",
      mainL = deparse(substitute(data)), mainC = colnames(eval.parent(substitute(data))))

Arguments

m

Numerical matrix

...

Additional arguments for text

tit

Overall title for plot. A vector of one or two elements. If an element is an expression, plotmath will be used.

rows

Number of rows of panels

cols

Number of columns of panels

f

A function to plot the individual plot panels. It can also be a statement sequence {...}

cex

Font size used for tit

reset

Should previous rows, cols be restored after execution. See note

outer

Passed on to mtext.

oma

Outer margin used in initial par(...).

mar

Lines of margin used in initial par(...).

data

Matrix or dataframe containing data, varibles in columns

breaks

Type of breaks for histogram

mainL

Label on top of scatterplot matrix or matrix of histograms

mainC

Labels on top of each of the histograms, should be character vector of length = number of columns of data

Value

These functions are called for their side effect to produce a plot.

WARNING

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!

Note

oldpar <- par(mfrow = c(rows, cols),oma=oma,mar=mar) is called at the beginning of pltRCT. Uses splom, [lattice:extend.limits]extend.limits, and datetime .

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. histRCT drops columns with less than 2 legal (non-NA) values. For empty matrices no plot will be generated.

Author(s)

Christian W. Hoffmann, christian@echoffmann.ch, with the assistance of Deepayan Sarkar Deepayan.Sarkar@r-project.org.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  x <- rnorm(100); y <- rnorm(100)+1; z <- y+rlnorm(100)
  pltRCT(1,1,f={plot(x,y,xlab="data with trend");
    abline(reg=lm(y~x),lty=2);points(x,z,pch=3)})
  nr <- 100; nc <- 8;
  pltRCT(1, 1, tit="1 by 1 plot", f=plot(y,x-3*y) )
  nr <- 25;  nc <- 16
  pltRCT(1, 2, f={plot(x,y,xlab="my x")
    m <- matrix(rnorm(nr*nc),nrow=25,ncol=nc)
    pltCharMat(m,cex=0.5,col="red")
  })

cwhmisc documentation built on May 1, 2019, 7:55 p.m.