Plot Columns of Matrices

DESCRIPTION:
Plots columns of one matrix against columns of another matrix.

USAGE:
matplot(x, y, type="p", lty=1:5, pch=<<see below>>, col=1:4)
matpoints(x, y, type="p", lty=1:5, pch=<<see below>>, col=1:4)
matlines(x, y, type="l", lty=1:5, pch=<<see below>>, col=1:4)

REQUIRED ARGUMENTS:
x,y:
vectors or matrices of data for plotting. The number of rows should match.
Missing values (NA) are allowed.

OPTIONAL ARGUMENTS:
type=:
character string, telling which type of plot ("p", points; "l", lines; "b", both; "n", none; or "h", high-density) should be done for each plot (column). The first character of type defines the first plot, the second character the second, etc. Characters in type are cycled through; e.g., "pl" alternately plots points and lines.
lty=:
vector of line types. The first element is for the first column, the second element for the second column, etc., even if lines are not plotted for all columns. Line types will be used cyclically until all plots are drawn.
pch=:
character string (length 1 vector) for plotting-characters. The first character is the plotting-character for the first plot, the second for the second, etc. The default is the digits (1 through 9, 0) then the letters. To mix special plotting symbols (those specified by integers) and plotting characters, either use character escapes pch="X\002" or figure out the numeric equivalent of the ASCII character, pch=c(88,2).
col=:
vector of colors. Colors are used cyclically.

Graphical parameters may also be supplied as arguments to this function (see par). In addition, the high-level graphics arguments described under par and the arguments to title may be supplied to this function.


SIDE EFFECTS:
Function matplot generates a new plot; matpoints and matlines add to the current plot.

DETAILS:
Points involving missing values are not plotted.

The first column of x is plotted against the first column of y, the second column of x against the second column of y, etc. If one matrix has fewer columns, plotting will cycle back through the columns again. (In particular, either x or y may be a vector, against which all columns of the other argument will be plotted.)

Because plotting symbols are drawn with lines and because these functions may be changing the line style, you should probably specify lty=1 when using plotting symbols.


SEE ALSO:
plot , matrix , par .

EXAMPLES:
#set up axes with vectors of extremes of data
matplot(c(1,8), c(0,4.5), type="n",
     xlab="Length", ylab="Width",
     main= "Petal and Sepal Dimensions in Iris Blossoms")
#add points for each species of iris separately
matpoints(iris[,c(1,3),1], iris[,c(2,4),1], pch="sS")
matpoints(iris[,c(1,3),2], iris[,c(2,4),2], pch="vV")
legend(1,4, c("Setosa Petals", "Setosa Sepals",
     "Versicolor Petals", "Versicolor Sepals"), pch="sSvV")

matplot(1:53, log(chernoff2[,c(1,10)]) ) # add line connecting points of column 1 matlines(1:53, log(chernoff2[,1]) )

matplot(iris[,3,], iris[,4,], xlab="Petal Length", ylab="Petal Width", pch="SCV", sub="S=Setosa, C=Versicolor, V=Virginica", main="Fisher's Iris Data", col=1)