Subversion Repositories bdplot

Rev

Rev 69 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
47 pdel 1
 
2
## so far, there's no end function, so should it just be called bdsharex?
65 pdel 3
bdsharex.start <- function(nplots,heights=NULL){
69 pdel 4
  if(is.null(heights)){
5
    heights <- rep(1,nplots)
6
  } else if(length(heights)!=nplots) {
7
    stop("If !is.null(heights), heights must be of length nplots.")
65 pdel 8
  }
69 pdel 9
 
68 pdel 10
  layout(1:(nplots+2), heights=c(lcm(0.1), heights, lcm(1)))
47 pdel 11
  ##  bdp(mar.lab=c(0,5,0.1,1),xaxt="n",las=1,mgp=c(3.5, 1, 0))
68 pdel 12
 
70 pdel 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
 
21
    bdp(cex.lab=bdp()$cex.lab*1.3)
22
    bdp(cex.axis=bdp()$cex.axis*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
  }
68 pdel 30
 
70 pdel 31
 
47 pdel 32
  bdp(mar.nolab=c(0,bdp()$mar.nolab[2],0,bdp()$mar.nolab[4]))
33
  bdp(mar.lab=c(0,bdp()$mar.lab[2],0,bdp()$mar.lab[4]))
34
 
35
  bdp(xaxt="n",las=1,mgp=c(3.5, 1, 0))
36
  bdplot(0, type="n", yaxt="n", bty="n", xlab="", ylab="")
37
  bdp(mar.nolab=c(0,bdp()$mar.nolab[2],0,bdp()$mar.nolab[4]))
38
}
39
 
48 pdel 40
bdsharex.end <- function(xlab=bdp()$xlab){
49 pdel 41
  mtext(xlab,1,line=1.5,cex=bdp()$cex.lab*par("cex"))
59 pdel 42
##  par(bty="n")
62 pdel 43
  oldbdp <- list()
44
  oldbdp$grid.h <- bdp()$grid.h
45
  oldbdp$grid.v <- bdp()$grid.v
46
  bdp(grid.v=NA)
47
  bdp(grid.h=NA)
48
  bdp(grid=FALSE)
49
  bdplot(1,1,type="n",xaxt="n",yaxt="n",bty="n",ylab="",rlab="")
50
  bdp(grid.h=oldbdp$grid.h,grid.v=oldbdp$grid.v)
70 pdel 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)
48 pdel 55
}