matplot2: Plot a matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/matplot2.R

Description

Plot the rows of a matrix. Useful for displaying a matrix of stage vectors, survival rates, sensitivities and so on.

Usage

1
2
3
4
5
matplot2(x, proportions = FALSE, legend = "topright", 
xlab = NULL,ylab = NULL, type = "l", las = 1, 
pch = c(15:18, 1:3), lwd = 1, lty = 1:nrow(x),
col = rainbow(nrow(x)), 
lcex = 1, lbty = "o", lcol = 1, ltitle = NULL, lsort=TRUE, ...)

Arguments

x

a matrix

proportions

If TRUE, then plot proportional changes

legend

a legend keyword or vector of x,y coordinates, defaults to top-right corner

xlab

a label for the x axis

ylab

a label for the y axis

type

plot type, default line

las

style of axis labels, default horizontal

pch

point types

lwd

line width

lty

line type

col

color

lcex

legend size expansion

lbty

legend box type

lcol

number of columns in legend

ltitle

legend title

lsort

sort legend by decreasing order of mean number in row

...

additional options are passed to plot function

Details

Only a few basic legend options are available. For more control, set legend=NA and run separately.

Value

A matrix plot

Author(s)

Chris Stubben

See Also

matplot and stage.vector.plot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
data(calathea)
# survival rates
x<-calathea[9:12]
x<-sapply(x, function(x) colSums(splitA(x, r=1:2)$T))
matplot2(t(x), legend="bottomright", ylab="Survival", 
main="Calathea survival curves")

# Growth rates - do not sort legend
x<-sapply(calathea[-17], lambda)
x<-matrix(x, nrow=4, byrow=TRUE, dimnames= list(paste("plot", 1:4), 1982:1985))
matplot2(x, type='b', lsort=FALSE, ylab="Growth rate", main="Calathea growth rates")

# Convergence to stable stage (excluding seeds)
x<-pop.projection(calathea[[7]], rep(1,8), 10)
matplot2(x$stage.vectors[-1,], prop=TRUE,
 main="Calathea stage vectors", lcex=.7)

popbio documentation built on May 4, 2018, 1:04 a.m.