Subversion Repositories bdplot

Rev

Rev 65 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
42 pdel 1
### a function to plot all columns in a matrix
2
 
66 pdel 3
bdmatplot <- function(x,y=NULL,cols=NULL,ltys=NULL,xlab=bdp()$xlab,...){
65 pdel 4
##  browser()
5
 
42 pdel 6
  if(is.null(y)){
65 pdel 7
    y <- as.matrix(x)
42 pdel 8
    dim.y <- dim(y)
9
    x <- 1:dim.y[1]
10
  } else {
65 pdel 11
    y <- as.matrix(y)
42 pdel 12
    dim.y <- dim(y)
13
  }
65 pdel 14
 
42 pdel 15
  if(is.null(cols))
16
    cols <- 2:(dim.y[2]+1)
17
 
65 pdel 18
  if(is.null(ltys))
42 pdel 19
    ltys <- rep(1,dim.y[2])
20
 
66 pdel 21
  bdplot(x,y[,1],ylim=range(y,na.rm=TRUE),col=cols[1],lty=ltys[1],xlab=xlab,...)
42 pdel 22
 
23
  if(dim.y[2]>1){
24
 
25
    for (i in 2:dim.y[2]){
26
      bdpoints(x,y[,i],col=cols[i],lty=ltys[i],...)
27
    }
28
 
29
  }
30
 
31
}
32
 
57 pdel 33
## for backward compatibility
34
bdplotmat <- bdmatplot