Subversion Repositories bdplot

Rev

Rev 24 | Go to most recent revision | Blame | Last modification | View Log | RSS feed

### a function to plot all columns in a matrix

bdplotmat <- function(x,y=NULL,cols=NULL,ltys=NULL,...){

  if(is.null(y)){
    y <- x
    dim.y <- dim(y)
    x <- 1:dim.y[1]
  } else {
    dim.y <- dim(y)
  }
##  print(dim.y)
  
  if(is.null(cols))
    cols <- 2:(dim.y[2]+1)

    if(is.null(ltys))
    ltys <- rep(1,dim.y[2])
##  print(cols)

  
  bdplot(x,y[,1],ylim=range(y,na.rm=TRUE),col=cols[1],lty=ltys[1],...)

  if(dim.y[2]>1){
    
    for (i in 2:dim.y[2]){
      bdxyadd(x,y[,i],col=cols[i],lty=ltys[i],...)
    }

  }

}