Subversion Repositories bdplot

Rev

Rev 57 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 57 Rev 65
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,...){
-
 
4
##  browser()
4
 
5
  
5
  if(is.null(y)){
6
  if(is.null(y)){
6
    y <- x
7
    y <- as.matrix(x)
7
    dim.y <- dim(y)
8
    dim.y <- dim(y)
8
    x <- 1:dim.y[1]
9
    x <- 1:dim.y[1]
9
  } else {
10
  } else {
-
 
11
    y <- as.matrix(y)
10
    dim.y <- dim(y)
12
    dim.y <- dim(y)
11
  }
13
  }
-
 
14
  ## if(is.null(dim(y))){
-
 
15
  ##   dim.y <- c(length(y),1)
-
 
16
  ## }
12
##  print(dim.y)
17
##  print(dim.y)
13
  
18
 
14
  if(is.null(cols))
19
  if(is.null(cols))
15
    cols <- 2:(dim.y[2]+1)
20
    cols <- 2:(dim.y[2]+1)
16
 
21
 
17
    if(is.null(ltys))
22
  if(is.null(ltys))
18
    ltys <- rep(1,dim.y[2])
23
    ltys <- rep(1,dim.y[2])
19
##  print(cols)
24
  ##  print(cols)
20
 
25
 
21
  
26
  
22
  bdplot(x,y[,1],ylim=range(y,na.rm=TRUE),col=cols[1],lty=ltys[1],...)
27
  bdplot(x,y[,1],ylim=range(y,na.rm=TRUE),col=cols[1],lty=ltys[1],...)
23
 
28
 
24
  if(dim.y[2]>1){
29
  if(dim.y[2]>1){
25
    
30
    
26
    for (i in 2:dim.y[2]){
31
    for (i in 2:dim.y[2]){
27
      bdpoints(x,y[,i],col=cols[i],lty=ltys[i],...)
32
      bdpoints(x,y[,i],col=cols[i],lty=ltys[i],...)
28
    }
33
    }
29
 
34
 
30
  }
35
  }
31
 
36
 
32
}
37
}
33
 
38
 
34
## for backward compatibility
39
## for backward compatibility
35
bdplotmat <- bdmatplot
40
bdplotmat <- bdmatplot
36
 
41