Subversion Repositories bdplot

Rev

Rev 15 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15 Rev 24
1
### a function to plot all columns in a matrix
1
### a function to plot all columns in a matrix
2
 
2
 
3
bdplotmat <- function(x,y=NULL,cols=NULL,...){
3
bdplotmat <- function(x,y=NULL,cols=NULL,...){
4
 
4
 
5
  if(is.null(y)){
5
  if(is.null(y)){
6
    y <- x
6
    y <- x
7
    dim.y <- dim(y)
7
    dim.y <- dim(y)
8
    x <- 1:dim.y[1]
8
    x <- 1:dim.y[1]
9
  } else {
9
  } else {
10
    dim.y <- dim(y)
10
    dim.y <- dim(y)
11
  }
11
  }
12
##  print(dim.y)
12
##  print(dim.y)
13
  
13
  
14
  if(is.null(cols))
14
  if(is.null(cols))
15
    cols <- 2:(dim.y[2]+1)
15
    cols <- 2:(dim.y[2]+1)
16
##  print(cols)
16
##  print(cols)
17
 
17
 
18
  
18
  
19
  bdplot(x,y[,1],ylim=range(y),col=cols[1],...)
19
  bdplot(x,y[,1],ylim=range(y,na.rm=TRUE),col=cols[1],...)
20
 
20
 
21
  if(dim.y[2]>1){
21
  if(dim.y[2]>1){
22
    
22
    
23
    for (i in 2:dim.y[2]){
23
    for (i in 2:dim.y[2]){
24
      bdxyadd(x,y[,i],col=cols[i],...)
24
      bdxyadd(x,y[,i],col=cols[i],...)
25
    }
25
    }
26
 
26
 
27
  }
27
  }
28
 
28
 
29
}
29
}
30
 
30
 
31
 
31
 
32
 
32