Subversion Repositories bdplot

Rev

Rev 29 | Rev 32 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 29 Rev 31
Line 127... Line 127...
127
               xlab=xlab,
127
               xlab=xlab,
128
               ylab=ylab,
128
               ylab=ylab,
129
               ...)
129
               ...)
130
  } 
130
  } 
131
  
131
  
-
 
132
###Grid stuff
-
 
133
  ## This really hould be done before adding the rest of the plot contents.
132
  ## We could make default values for grid.v og grid.h. Man maa kunne lave noget kvalificeret ud fra range og noget heltalsdivision
134
  ## We could make default values for grid.v og grid.h. Man maa kunne lave noget kvalificeret ud fra range og noget heltalsdivision
133
  
135
  
134
  ##Grid stuff
-
 
135
  if( prm$grid ){
136
  if( prm$grid ){
136
    grid(col=prm$grid.col)
137
    grid(col=prm$grid.col)
137
  }
138
  }
138
  ## vertical lines
139
  ## vertical lines
139
  if( !is.na(prm$grid.v) ){
140
  if( !is.na(prm$grid.v) ){
Line 150... Line 151...
150
      grid(nx=NA,ny=NULL,col=prm$grid.col)
151
      grid(nx=NA,ny=NULL,col=prm$grid.col)
151
    }else{
152
    }else{
152
      abline(h=prm$grid.h, lty="dotted", col=prm$grid.col)}
153
      abline(h=prm$grid.h, lty="dotted", col=prm$grid.col)}
153
    }
154
    }
154
 
155
 
-
 
156
### Axis stuff This part should be improved. A function that draws
-
 
157
### axis should be run for all four axis. And it should be possible to
-
 
158
### supply whatever vector to base it on (especially relevant for
155
  ## Axis stuff
159
### taxis and raxis)
-
 
160
  
-
 
161
  ## this is because the use of mgp gives a ridiculous warning when too small
-
 
162
  options(warn=-1)
156
  if(prm$draw.xaxis){
163
  if(prm$draw.xaxis){
157
    ##    mgp.old <- par()$mgp
164
    ##    mgp.old <- par()$mgp
158
    ##    par(mgp) <- mgp.xaxis
165
    ##    par(mgp) <- mgp.xaxis
159
    options(warn=-1)
166
    ## is the abscissa a time object?
160
    if( "POSIXt"%in%class(x[1])){
167
    if( "POSIXt"%in%class(x[1])){
161
      axis.POSIXct(1, x,mgp=prm$mgp.xaxis, lwd=prm$lwd)
168
      axis.POSIXct(1, x,mgp=prm$mgp.xaxis, lwd=prm$lwd)
162
    } else {
169
    } else {
163
      axis(1, mgp=prm$mgp.xaxis, lwd=prm$lwd)
170
      axis(1, mgp=prm$mgp.xaxis, lwd=prm$lwd)
164
    }
171
    }
165
    options(warn=0)
-
 
166
    
172
    
167
  }
173
  }
-
 
174
 
168
  if(prm$draw.yaxis){ axis(2, mgp=prm$mgp.yaxis, lwd=prm$lwd) }
175
  if(prm$draw.yaxis){ axis(2, y,mgp=prm$mgp.yaxis, lwd=prm$lwd) }
-
 
176
  ## top axis
-
 
177
  if(prm$draw.taxis){ axis(3, mgp=prm$mgp.taxis, lwd=prm$lwd) }
169
  ## axis to the right
178
  ## axis to the right
170
  if(prm$draw.raxis){ axis(4, mgp=prm$mgp.raxis, lwd=prm$lwd) }
179
  if(prm$draw.raxis){ axis(4, mgp=prm$mgp.raxis, lwd=prm$lwd) }
-
 
180
 
-
 
181
  ## switch back on warnings
-
 
182
  options(warn=0)
-
 
183
 
-
 
184
 
171
  ##Title stuff
185
  ##Title stuff
172
  ## Hvorfor??
186
  ## Hvorfor??
173
  scale <- 1
187
  scale <- 1
174
  ##  if( prm$type=="hist" & !is.na(prm$xlab) )
188
  ##  if( prm$type=="hist" & !is.na(prm$xlab) )
175
#  if( !is.na(prm$xlab)  ){ mtext(prm$xlab, line=prm$xlabLine, side=1, cex=prm$cex.lab/scale) }
189
#  if( !is.na(prm$xlab)  ){ mtext(prm$xlab, line=prm$xlabLine, side=1, cex=prm$cex.lab/scale) }