Description Usage Arguments Examples
Plot the columns of one matrix against the columns of another, with conditionnal background for easier comparison of curves.
1 2 3 4 5 6 7 8 9 10 11 12 13 |
x |
the abscisses |
y |
matrix of the curves (columns) |
col |
list of colors (like in matplot) |
alpha |
parameter for transparency of the background |
what |
a function to choose a winner. Takes y as an input and must return a vector of colors (can be positive integers) of size length(x) |
ylim |
ranges of y axe |
xlim |
ranges of x axe |
type |
character string (length 1 vector) or vector of 1-character strings indicating the type of plot for each column of y. 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. |
xlab |
title for x axe |
ylab |
title for y axe |
... |
Other graphical parameters |
1 2 3 4 5 6 7 8 9 | n = 15
x = 1:n
y = cbind(c(rnorm(5, 0, 1), rnorm(5, 1, 1), rnorm(5, 2, 1)),
c(rnorm(5, 0, 1), rnorm(5, 1, 1), rnorm(5, 4, 1)),
c(rnorm(5, 1, 3), rnorm(5, 1, 2), rnorm(5, 1, 1)))
matplot_zone(x, y, type = "l", what = which.max, main = "Highest curve")
# background color follows color of the highest curve
matplot_zone(x, y, type = "l", what = which.min, main = "Lowest curve")
# background color follows color of the lowest curve
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.