Subversion Repositories bdplot

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
55 pdel 1
### this is supposed to set all par vars so that plot or another plotting command can be used.
2
 
3
## example on purpose:
4
## bdopen()
5
## bdinit()
6
## boxplot(x)
7
## bddev.off()
8
 
9
 
10
## It's a mess to set cex.lab here. Or it should not be set in
11
##  functions calls. If set both ways, it's scaled twice, meaning that
12
##  we don't know how to make it fit with mtext for eg rlab.
13
 
14
bdinit <- function(){
15
 
16
##  par(cex.main=bdp()$cex.main, cex.lab=bdp()$cex.lab,
17
##      cex.axis=bdp()$cex.axis,cex=bdp()$cex.plot)
18
 
19
  par(cex=bdp()$cex.plot)  
20
 
21
  par(tcl=bdp()$tcl)
22
  par(lwd=bdp()$lwd)
23
  par(bty=bdp()$bty)
24
 
25
 
26
  ##Set margins. If mar is set, then that should be used.
27
  if (!is.null(bdp()$mar)){
28
    print(bdp()$mar)
29
    mar <- bdp()$mar
30
  } else {
31
 
32
    detmar <- function(idx,lab){
33
      if (is.null(lab)) {
34
        mar <- bdp()$mar.lab[idx]
35
      } else if(all(is.na(lab))) {
36
        mar <- bdp()$mar.nolab[idx]
37
      } else {
38
        mar <- bdp()$mar.lab[idx]
39
      }
40
      return(mar)
41
    }
42
    mar <- c(detmar(1,bdp()$xlab),
43
             detmar(2,bdp()$ylab),
44
             detmar(3,bdp()$tlab),
45
             detmar(4,bdp()$rlab))
46
 
47
  }
48
  par(mar=mar)
49
 
50
  par(mgp=bdp()$mgp.global)
51
 
52
}
53