Subversion Repositories bdplot

Rev

Rev 51 | Blame | Compare with Previous | Last modification | View Log | RSS feed

.bdcalcsizes <- function(paper=bdp()$paper,mfrow=c(1,1),scaleheight=1,height=bdp()$height)
  {

    ## scaleheight is kind of a hack. We need to be able to the height
    ## without using mfrow. This is for sharing the x axis between
    ## plots.
    
    prm <- bdp()
    paperpars <- prm[[paper]]
### columns, half, quadratic er levn fra et gammelt hack. skal erstattes med skabeloner.
###    columns <- 1
###    half <- FALSE
###    quadratic <- FALSE

### first, the height
    ## should switch be used?
### if height is supplied explicitly by the user, this overrules paper
### settings
    if(!is.null(height)){
      bdp(height=height)
    } else {
      if(any(mfrow<1)){
        stop("Both elements in bdp()$mfrow must be positive. Exiting...")
      }
      
      if(mfrow[1]*scaleheight<=4){
        height.touse <- min(mfrow[1]*scaleheight*paperpars$height,paperpars$height.full)
        print(height.touse)
        bdp(height=height.touse)
      } else {
        bdp(height=paperpars$height.full)
      }
    }
### then the width
    bdp(width=paperpars$width)
    bdp(size.unit=paperpars$size.unit)
  }

## ### first, the height
##     if(mfrow[1]==1){
##       bdp(height=paperpars$height)
##     } else if(mfrow[1]<4){
## #### en graf fylder 1/3, 4 graf fylder det hele
##       r <- (3/4)^(1/3)
##       bdp(height=mfrow[1]*1/3*paperpars$height.full*r^(mfrow[1]-1))
##     } else {
##       bdp(height=paperpars$height.full)
##     }