Subversion Repositories bdplot

Rev

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

Rev 69 Rev 70
1
 
1
 
2
## so far, there's no end function, so should it just be called bdsharex?
2
## so far, there's no end function, so should it just be called bdsharex?
3
bdsharex.start <- function(nplots,heights=NULL){
3
bdsharex.start <- function(nplots,heights=NULL){
4
  if(is.null(heights)){
4
  if(is.null(heights)){
5
    heights <- rep(1,nplots)
5
    heights <- rep(1,nplots)
6
  } else if(length(heights)!=nplots) {
6
  } else if(length(heights)!=nplots) {
7
    stop("If !is.null(heights), heights must be of length nplots.")
7
    stop("If !is.null(heights), heights must be of length nplots.")
8
  }
8
  }
9
  
9
  
10
  layout(1:(nplots+2), heights=c(lcm(0.1), heights, lcm(1)))
10
  layout(1:(nplots+2), heights=c(lcm(0.1), heights, lcm(1)))
11
  ##  bdp(mar.lab=c(0,5,0.1,1),xaxt="n",las=1,mgp=c(3.5, 1, 0))
11
  ##  bdp(mar.lab=c(0,5,0.1,1),xaxt="n",las=1,mgp=c(3.5, 1, 0))
12
 
12
 
13
  ## Labels seem to be scaled. Need adjustment. This looks ok at least sometimes.
13
  ## Labels seem to be scaled. Need adjustment so that it is reset
-
 
14
  ## after bdsharex.end. This looks ok at least sometimes.
-
 
15
  if(is.null(bdp()$saved.cex.lab)){
-
 
16
    
-
 
17
    bdp(saved.cex.lab=bdp()$cex.lab)
-
 
18
    bdp(saved.cex.axis=bdp()$cex.axis)
-
 
19
    bdp(saved.cex.legend=bdp()$cex.legend)
-
 
20
    
14
  bdp(cex.lab=bdp()$cex.lab*1.3)
21
    bdp(cex.lab=bdp()$cex.lab*1.3)
15
  bdp(cex.axis=bdp()$cex.axis*1.3)
22
    bdp(cex.axis=bdp()$cex.axis*1.3)
16
  bdp(cex.legend = bdp()$cex.legend*1.3)
23
    bdp(cex.legend = bdp()$cex.legend*1.3)
-
 
24
  }
-
 
25
  else {
-
 
26
    bdp(cex.lab=bdp()$saved.cex.lab*1.3)
-
 
27
    bdp(cex.axis=bdp()$saved.cex.axis*1.3)
-
 
28
    bdp(cex.legend = bdp()$saved.cex.legend*1.3)
-
 
29
  }
17
 
30
  
18
  
31
  
19
  bdp(mar.nolab=c(0,bdp()$mar.nolab[2],0,bdp()$mar.nolab[4]))
32
  bdp(mar.nolab=c(0,bdp()$mar.nolab[2],0,bdp()$mar.nolab[4]))
20
  bdp(mar.lab=c(0,bdp()$mar.lab[2],0,bdp()$mar.lab[4]))
33
  bdp(mar.lab=c(0,bdp()$mar.lab[2],0,bdp()$mar.lab[4]))
21
  
34
  
22
  bdp(xaxt="n",las=1,mgp=c(3.5, 1, 0))
35
  bdp(xaxt="n",las=1,mgp=c(3.5, 1, 0))
23
  bdplot(0, type="n", yaxt="n", bty="n", xlab="", ylab="")
36
  bdplot(0, type="n", yaxt="n", bty="n", xlab="", ylab="")
24
  bdp(mar.nolab=c(0,bdp()$mar.nolab[2],0,bdp()$mar.nolab[4]))
37
  bdp(mar.nolab=c(0,bdp()$mar.nolab[2],0,bdp()$mar.nolab[4]))
25
}
38
}
26
 
39
 
27
bdsharex.end <- function(xlab=bdp()$xlab){
40
bdsharex.end <- function(xlab=bdp()$xlab){
28
  mtext(xlab,1,line=1.5,cex=bdp()$cex.lab*par("cex"))
41
  mtext(xlab,1,line=1.5,cex=bdp()$cex.lab*par("cex"))
29
##  par(bty="n")
42
##  par(bty="n")
30
  oldbdp <- list()
43
  oldbdp <- list()
31
  oldbdp$grid.h <- bdp()$grid.h
44
  oldbdp$grid.h <- bdp()$grid.h
32
  oldbdp$grid.v <- bdp()$grid.v
45
  oldbdp$grid.v <- bdp()$grid.v
33
  bdp(grid.v=NA)
46
  bdp(grid.v=NA)
34
  bdp(grid.h=NA)
47
  bdp(grid.h=NA)
35
  bdp(grid=FALSE)
48
  bdp(grid=FALSE)
36
  bdplot(1,1,type="n",xaxt="n",yaxt="n",bty="n",ylab="",rlab="")
49
  bdplot(1,1,type="n",xaxt="n",yaxt="n",bty="n",ylab="",rlab="")
37
  bdp(grid.h=oldbdp$grid.h,grid.v=oldbdp$grid.v)
50
  bdp(grid.h=oldbdp$grid.h,grid.v=oldbdp$grid.v)
-
 
51
 
-
 
52
  bdp(cex.lab=bdp()$saved.cex.lab)
-
 
53
  bdp(cex.axis=bdp()$saved.cex.axis)
-
 
54
  bdp(cex.legend=bdp()$saved.cex.legend)
38
}
55
}
39
 
56