Matplot with curves comparison by background colors.

Share:

Description

Plot the columns of one matrix against the columns of another, with conditionnal background for easier comparison of curves.

Usage

1
2
matplot_zone(x = x, y = y, col = 1:6, alpha = 0.2, what = which.min,
  ylim = NULL, xlim = NULL, type = "p", xlab = NULL, ylab = NULL, ...)

Arguments

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
    ## Not run: 
require(CorReg)
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


## End(Not run)