Subversion Repositories bdplot

Rev

Rev 65 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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