Subversion Repositories bdplot

Rev

Rev 57 | Go to most recent revision | 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
 
57 pdel 3
bdmatplot <- function(x,y=NULL,cols=NULL,ltys=NULL,...){
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
  ## if(is.null(dim(y))){
15
  ##   dim.y <- c(length(y),1)
16
  ## }
42 pdel 17
##  print(dim.y)
65 pdel 18
 
42 pdel 19
  if(is.null(cols))
20
    cols <- 2:(dim.y[2]+1)
21
 
65 pdel 22
  if(is.null(ltys))
42 pdel 23
    ltys <- rep(1,dim.y[2])
65 pdel 24
  ##  print(cols)
42 pdel 25
 
26
 
27
  bdplot(x,y[,1],ylim=range(y,na.rm=TRUE),col=cols[1],lty=ltys[1],...)
28
 
29
  if(dim.y[2]>1){
30
 
31
    for (i in 2:dim.y[2]){
32
      bdpoints(x,y[,i],col=cols[i],lty=ltys[i],...)
33
    }
34
 
35
  }
36
 
37
}
38
 
57 pdel 39
## for backward compatibility
40
bdplotmat <- bdmatplot