Subversion Repositories bdplot

Rev

Rev 58 | Rev 60 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 58 Rev 59
1
### bdplot.R
1
### bdplot.R
2
#### This is a collection of functions that must bpre reachable by the user This is called 
2
#### This is a collection of functions that must bpre reachable by the user This is called 
3
 
3
 
4
 
4
 
5
## strategy missing for xytype
5
## strategy missing for xytype
6
## Could we test if there is an active graphics device? And if not, run bdopen()?
6
## Could we test if there is an active graphics device? And if not, run bdopen()?
7
bdplot <- function(x, y=NULL, z=NULL,
7
bdplot <- function(x, y=NULL, z=NULL,
8
                   ## The rest is irrelevant for the user
8
                   ## The rest is irrelevant for the user
9
                   cex.plot=bdp()$cex.plot,
9
                   cex.plot=bdp()$cex.plot,
10
                   cex.main=bdp()$cex.main,
10
                   cex.main=bdp()$cex.main,
11
                   cex.sub=bdp()$cex.sub,
11
                   cex.sub=bdp()$cex.sub,
12
                   xaxt=bdp()$xaxt,yaxt=bdp()$yaxt,
12
                   xaxt=bdp()$xaxt,yaxt=bdp()$yaxt,
13
                   xaxt.in=bdp()$xaxt.in,yaxt.in=bdp()$xaxt.in,
13
                   xaxt.in=bdp()$xaxt.in,yaxt.in=bdp()$xaxt.in,
14
                   xlab=bdp()$xlab, ylab=bdp()$ylab,
14
                   xlab=bdp()$xlab, ylab=bdp()$ylab,
15
                   tlab=bdp()$tlab, rlab=bdp()$rlab,
15
                   tlab=bdp()$tlab, rlab=bdp()$rlab,
16
                   xlim=bdp()$xlim,ylim=bdp()$ylim,
16
                   xlim=bdp()$xlim,ylim=bdp()$ylim,
17
                   col=bdp()$col,main=NULL,
17
                   col=bdp()$col,main=NULL,
18
                   ## only used in case of plot mode
18
                   ## only used in case of plot mode
19
                   type=bdp()$type,
19
                   type=bdp()$type,
20
                   ## Only used in case of histogram plotting
20
                   ## Only used in case of histogram plotting
21
                   border=bdp()$border,freq=NULL,
21
                   border=bdp()$border,freq=NULL,
22
                   ...){
22
                   ...){
23
 
23
 
24
 
24
 
25
  ## experimental. Is this the right consequence of not having a
25
  ## experimental. Is this the right consequence of not having a
26
  ## device opened?
26
  ## device opened?
27
  
27
  
28
  if(length(dev.list())==0){
28
  if(length(dev.list())==0){
29
    cat("No graphics device is initialised. Running bdopen() without arguments.\n")
29
    cat("No graphics device is initialised. Running bdopen() without arguments.\n")
30
    bdopen()
30
    bdopen()
31
  }
31
  }
32
  
32
  
33
## we'd like to be able to setup the plotting device from different functions. It's better to use bdp() to handle values then.
33
## we'd like to be able to setup the plotting device from different functions. It's better to use bdp() to handle values then.
34
  bdp(xlab=xlab,ylab=ylab,rlab=rlab,tlab=tlab,
34
  bdp(xlab=xlab,ylab=ylab,rlab=rlab,tlab=tlab,
35
      cex.plot=cex.plot)
35
      cex.plot=cex.plot)
36
  
36
  
37
  prm <- bdp()
37
  prm <- bdp()
38
 
38
 
39
############# init starts - to be put in seperate function?
39
############# init starts - to be put in seperate function?
40
  
40
  
41
## It's a mess to set cex.lab here. Or it should not be set in
41
## It's a mess to set cex.lab here. Or it should not be set in
42
##  functions calls. If set both ways, it's scaled twice, meaning that
42
##  functions calls. If set both ways, it's scaled twice, meaning that
43
##  we don't know how to make it fit with mtext for eg rlab.
43
##  we don't know how to make it fit with mtext for eg rlab.
44
  par(cex.main=prm$cex.main, cex.lab=prm$cex.lab,
44
  par(cex.main=prm$cex.main, cex.lab=prm$cex.lab,
45
  cex.axis=prm$cex.axis)
45
  cex.axis=prm$cex.axis)
46
 
46
 
47
  par(tcl=prm$tcl)
47
  par(tcl=prm$tcl)
48
  par(lwd=prm$lwd)
48
  par(lwd=prm$lwd)
49
  par(bty=prm$bty)
49
  par(bty=prm$bty)
50
 
50
 
51
 
51
 
52
 ##Set margins. If mar is set, then that should be used.
52
 ##Set margins. If mar is set, then that should be used.
53
  if (!is.null(prm$mar)){
53
  if (!is.null(prm$mar)){
54
    print(prm$mar)
54
    print(prm$mar)
55
    mar <- prm$mar
55
    mar <- prm$mar
56
  } else {
56
  } else {
57
 
57
 
58
    detmar <- function(idx,lab){
58
    detmar <- function(idx,lab){
59
      if (is.null(lab)) {
59
      if (is.null(lab)) {
60
        mar <- prm$mar.lab[idx]
60
        mar <- prm$mar.lab[idx]
61
      } else if(all(is.na(lab))) {
61
      } else if(all(is.na(lab))) {
62
        mar <- prm$mar.nolab[idx]
62
        mar <- prm$mar.nolab[idx]
63
      } else {
63
      } else {
64
        mar <- prm$mar.lab[idx]
64
        mar <- prm$mar.lab[idx]
65
      }
65
      }
66
      return(mar)
66
      return(mar)
67
    }
67
    }
68
##    browser()
68
##    browser()
69
    mar <- c(detmar(1,xlab),
69
    mar <- c(detmar(1,xlab),
70
             detmar(2,ylab),
70
             detmar(2,ylab),
71
             detmar(3,tlab)+ifelse(is.null(main),0,prm$mar.main),
71
             detmar(3,tlab)+ifelse(is.null(main),0,prm$mar.main),
72
             detmar(4,rlab))
72
             detmar(4,rlab))
73
##    print(length(mar))
73
##    print(length(mar))
74
##    print(mar)    
74
##    print(mar)    
75
  }
75
  }
76
  par(mar=mar)
76
  par(mar=mar)
77
 
77
 
78
  par(mgp=prm$mgp.global)
78
  par(mgp=prm$mgp.global)
79
 
79
 
80
########### init done
80
########### init done
81
 
81
 
82
  
82
  
83
### xaxt and yaxt can be set to "axis" which is the special case where the axis is drawn with the axis
83
### xaxt and yaxt can be set to "axis" which is the special case where the axis is drawn with the axis
84
  if(class(xaxt)=="function") {
84
  if(class(xaxt)=="function") {
85
 
85
 
86
    if(is.null(xaxt.in))
86
    if(is.null(xaxt.in))
87
      xaxt.in <- x
87
      xaxt.in <- x
88
 
88
 
89
    draw.xaxis <- "fun"
89
    draw.xaxis <- "fun"
90
    xaxt.fun <- xaxt
90
    xaxt.fun <- xaxt
91
    xaxt <- "n"
91
    xaxt <- "n"
92
  } else if(xaxt=="axis"){
92
  } else if(xaxt=="axis"){
93
    xaxt <- "n"
93
    xaxt <- "n"
94
    draw.xaxis <- TRUE
94
    draw.xaxis <- TRUE
95
  } else {
95
  } else {
96
    draw.xaxis <- FALSE
96
    draw.xaxis <- FALSE
97
  }
97
  }
98
  if(class(yaxt)=="function") {
98
  if(class(yaxt)=="function") {
99
    yaxt(ifelse(is.null(yaxt.in),range(y),yaxt.in))
99
    yaxt(ifelse(is.null(yaxt.in),range(y),yaxt.in))
100
    draw.yaxis <- FALSE
100
    draw.yaxis <- FALSE
101
  } else if(yaxt=="axis"){
101
  } else if(yaxt=="axis"){
102
    yaxt <- "n"
102
    yaxt <- "n"
103
    draw.yaxis <- TRUE
103
    draw.yaxis <- TRUE
104
  } else {
104
  } else {
105
    draw.yaxis <- FALSE
105
    draw.yaxis <- FALSE
106
  }
106
  }
107
  
107
  
108
 
108
 
109
 
109
 
110
### this variable needs to be initialized. Why?
110
### this variable needs to be initialized. Why?
111
  addcase <- NULL
111
  addcase <- NULL
112
  
112
  
113
  ## Do the plot
113
  ## Do the plot
114
  if(!is.null(y)){
114
  if(!is.null(y)){
115
 
115
 
116
    if(!is.null(z)){
116
    if(!is.null(z)){
117
      if(prm$debug)
117
      if(prm$debug)
118
        cat("bdgraphics operating in image plotting mode.\nx and y axis can not be configured.\n")
118
        cat("bdgraphics operating in image plotting mode.\nx and y axis can not be configured.\n")
119
      image(x=x,y=y,z=z,
119
      image(x=x,y=y,z=z,
120
            xlab=xlab,
120
            xlab=xlab,
121
            ylab=ylab,
121
            ylab=ylab,
122
            ...)
122
            ...)
123
    } else {
123
    } else {
124
      if(prm$debug)
124
      if(prm$debug)
125
        cat("The Bacher/Delff Plotting System (R), (C), TM operating in xy-plotting mode.\n")
125
        cat("The Bacher/Delff Plotting System (R), (C), TM operating in xy-plotting mode.\n")
126
      
126
      
127
      ## this is ugly, non standard.
127
      ## this is ugly, non standard.
128
      if(is.null(xlim))
128
      if(is.null(xlim))
129
        xlim <- range(x,na.rm=TRUE) #,bdp()$xlim,na.rm=TRUE)
129
        xlim <- range(x,na.rm=TRUE) #,bdp()$xlim,na.rm=TRUE)
130
      if(is.null(ylim))
130
      if(is.null(ylim))
131
        ylim <- range(y,na.rm=TRUE) #,bdp()$ylim,na.rm=TRUE)
131
        ylim <- range(y,na.rm=TRUE) #,bdp()$ylim,na.rm=TRUE)
132
 
132
 
133
      xlabel <- if (!missing(x)) 
133
      xlabel <- if (!missing(x)) 
134
        deparse(substitute(x))
134
        deparse(substitute(x))
135
      ylabel <- if (!missing(y)) 
135
      ylabel <- if (!missing(y)) 
136
        deparse(substitute(y))
136
        deparse(substitute(y))
137
      ##       xy <- xy.coords(x, y, xlabel, ylabel, log)
137
      ##       xy <- xy.coords(x, y, xlabel, ylabel, log)
138
      xlab <- ifelse(is.null(xlab), xlabel, xlab)
138
      xlab <- ifelse(is.null(xlab), xlabel, xlab)
139
      ylab <- ifelse(is.null(ylab), ylabel, ylab)
139
      ylab <- ifelse(is.null(ylab), ylabel, ylab)
140
 
140
 
141
      ## here we make the empty plot
141
      ## here we make the empty plot
142
      plot(x, y,
142
      plot(x, y,
143
           type="n",
143
           type="n",
144
           xaxt=xaxt, yaxt=yaxt,
144
           xaxt=xaxt, yaxt=yaxt,
145
           cex=cex.plot,
145
           cex=cex.plot,
146
           xlab=xlab,
146
           xlab=xlab,
147
           ylab=ylab,
147
           ylab=ylab,
148
           xlim=xlim,
148
           xlim=xlim,
149
           ylim=ylim,
149
           ylim=ylim,
150
           main=main,
150
           main=main,
151
           ...)
151
           ...)
152
 
152
 
153
      addcase <- "plotxy"
153
      addcase <- "plotxy"
154
      
154
      
155
    }
155
    }
156
  } else if (is.numeric(x)){
156
  } else if (is.numeric(x)){
157
    if(prm$method=="barplot"){
157
    if(prm$method=="barplot"){
158
      if(prm$debug)
158
      if(prm$debug)
159
        cat("The Bacher/Delff Plotting System (R), (C), TM operating in barplot mode.\n")
159
        cat("The Bacher/Delff Plotting System (R), (C), TM operating in barplot mode.\n")
160
      ## this does not provide the full x,y functionality of barplot
160
      ## this does not provide the full x,y functionality of barplot
161
      barplot(height=x,
161
      barplot(height=x,
162
              ## maybe these two are wrong/stupid?
162
              ## maybe these two are wrong/stupid?
163
              cex.axis=prm$cex.lab,
163
              cex.axis=prm$cex.lab,
164
              cex.names=prm$cex.lab,
164
              cex.names=prm$cex.lab,
165
              col=bdp()$hcol,
165
              col=bdp()$hcol,
166
              border=border,
166
              border=border,
167
              xlab=xlab,
167
              xlab=xlab,
168
              ylab=ylab,
168
              ylab=ylab,
-
 
169
              ylim=ylim,
169
              main=main,
170
              main=main,
170
              ...)
171
              ...)
171
      draw.xaxis <- FALSE
172
      draw.xaxis <- FALSE
172
      draw.yaxis <- FALSE
173
      draw.yaxis <- FALSE
173
      
174
      
174
    } else {
175
    } else {
175
      if(prm$debug)
176
      if(prm$debug)
176
        cat("The Bacher/Delff Plotting System operating in xy-plotting mode, only plotting x.\n")
177
        cat("The Bacher/Delff Plotting System operating in xy-plotting mode, only plotting x.\n")
177
 
178
 
178
      if(is.null(xlim))
179
      if(is.null(xlim))
179
        xlim <- c(1,length(x))#,bdp()$xlim),na.rm=TRUE)
180
        xlim <- c(1,length(x))#,bdp()$xlim),na.rm=TRUE)
180
      
181
      
181
      if(is.null(ylim))
182
      if(is.null(ylim))
182
        ylim <- range(x,na.rm=TRUE)#,bdp()$ylim,na.rm=TRUE)
183
        ylim <- range(x,na.rm=TRUE)#,bdp()$ylim,na.rm=TRUE)
183
      
184
      
184
      plot(x,
185
      plot(x,
185
           type="n",
186
           type="n",
186
           xaxt=xaxt, yaxt=yaxt,
187
           xaxt=xaxt, yaxt=yaxt,
187
           cex=cex.plot,
188
           cex=cex.plot,
188
           xlab=xlab,
189
           xlab=xlab,
189
           ylab=ylab,
190
           ylab=ylab,
190
           xlim=xlim,
191
           xlim=xlim,
191
           ylim=ylim,
192
           ylim=ylim,
192
           main=main,
193
           main=main,
193
           ...)
194
           ...)
194
      addcase <- "plotx"
195
      addcase <- "plotx"
195
    }
196
    }
196
  } else if( class(x) == "acf"){
197
  } else if( class(x) == "acf"){
197
    ## Not cleaned up/checked
198
    ## Not cleaned up/checked
198
    plot(x, xlab="", ylab="", xaxt=xaxt, yaxt=yaxt, cex=prm$cex.plot, xlim=prm$xlim, ylim=prm$ylim,col=col,...)
199
    plot(x, xlab="", ylab="", xaxt=xaxt, yaxt=yaxt, cex=prm$cex.plot, xlim=prm$xlim, ylim=prm$ylim,col=col,...)
199
  }  else if( class(x) == "histogram"){
200
  }  else if( class(x) == "histogram"){
200
    ## Notice: the color of the bars can ONLY be set width bdp(hcol="color").
201
    ## Notice: the color of the bars can ONLY be set width bdp(hcol="color").
201
    plot(x,
202
    plot(x,
202
         xlab=xlab,ylab=ylab,
203
         xlab=xlab,ylab=ylab,
203
         main=main,freq=freq,
204
         main=main,freq=freq,
204
         xaxt=xaxt,yaxt=yaxt,col=bdp()$hcol,
205
         xaxt=xaxt,yaxt=yaxt,col=bdp()$hcol,
205
         border=border,
206
         border=border,
206
         ...)
207
         ...)
207
  } else if( class(x) == "trellis"){
208
  } else if( class(x) == "trellis"){
208
    ## Not cleaned up/checked
209
    ## Not cleaned up/checked
209
    ## very experimental
210
    ## very experimental
210
    cat("The Bacher/Delff Plotting System (R), (C), TM operating in lattice mode.\n Remeber that labels must written in the lattice object.\n")
211
    cat("The Bacher/Delff Plotting System (R), (C), TM operating in lattice mode.\n Remeber that labels must written in the lattice object.\n")
211
    ##lattice.options(layout.widths = prm$lattice.width,
212
    ##lattice.options(layout.widths = prm$lattice.width,
212
    ##                layout.heights = prm$lattice.height)
213
    ##                layout.heights = prm$lattice.height)
213
    trellis.par.set(prm$myLatticeSettings()) 
214
    trellis.par.set(prm$myLatticeSettings()) 
214
    plot(x,col=col,...)
215
    plot(x,col=col,...)
215
    ## with lattice/trellis, the axis drawing doesn't work.
216
    ## with lattice/trellis, the axis drawing doesn't work.
216
    draw.xaxis <- FALSE
217
    draw.xaxis <- FALSE
217
    draw.yaxis <- FALSE
218
    draw.yaxis <- FALSE
218
  } else if (class(x)=="princomp") {
219
  } else if (class(x)=="princomp") {
219
    if(prm$debug)
220
    if(prm$debug)
220
      cat("The Bacher/Delff Plotting System operating in princomp plotting mode.\n")
221
      cat("The Bacher/Delff Plotting System operating in princomp plotting mode.\n")
221
    plot(x,
222
    plot(x,
222
         main=main,
223
         main=main,
223
         ...)
224
         ...)
224
  } else if (class(x)=="lm") {
225
  } else if (class(x)=="lm") {
225
    print("lm mode. This is experimental, mar and oma are set to fixed values.")
226
    print("lm mode. This is experimental, mar and oma are set to fixed values.")
226
    par(mar=c(2,2,2,.3))
227
    par(mar=c(2,2,2,.3))
227
    par(oma = c(0, 0, 0, 0))
228
    par(oma = c(0, 0, 0, 0))
228
    par(cex=0.4)
229
    par(cex=0.4)
229
    ### cex.caption is the title over each plot, cex.id magnification of point labels. What is eg "Cook's distance" written inside the plots?
230
    ### cex.caption is the title over each plot, cex.id magnification of point labels. What is eg "Cook's distance" written inside the plots?
230
    plot.lm(x,cex.caption=cex.sub,cex.id=.5)##,cex=cex.plot)
231
    plot.lm(x,cex.caption=cex.sub,cex.id=.5)##,cex=cex.plot)
231
  }  else if (class(x)=="data.frame") {
232
  }  else if (class(x)=="data.frame") {
232
    print("data.frame mode")
233
    print("data.frame mode")
233
    plot(x,main=main,
234
    plot(x,main=main,
234
         xaxt=xaxt,yaxt=yaxt)
235
         xaxt=xaxt,yaxt=yaxt)
235
  }else if (prm$method=="image.plot"){
236
  }else if (prm$method=="image.plot"){
236
    ### This could be checked in the beginning by is.null(z)
237
    ### This could be checked in the beginning by is.null(z)
237
  }
238
  }
238
  
239
  
239
###Grid stuff
240
###Grid stuff
240
  ## This really hould be done before adding the rest of the plot contents.
241
  ## This really hould be done before adding the rest of the plot contents.
241
  ## We could make default values for grid.v og grid.h. Man maa kunne lave noget kvalificeret ud fra range og noget heltalsdivision
242
  ## We could make default values for grid.v og grid.h. Man maa kunne lave noget kvalificeret ud fra range og noget heltalsdivision
242
  
243
  
243
  if( prm$grid ){
244
  if( prm$grid ){
244
    grid(col=prm$grid.col)
245
    grid(col=prm$grid.col)
245
  }
246
  }
246
  ## vertical lines
247
  ## vertical lines
247
  if( !is.na(prm$grid.v) ){
248
  if( !is.na(prm$grid.v) ){
248
    if(prm$grid.v=="Def"){
249
    if(prm$grid.v=="Def"){
249
      grid(nx=NULL,ny=NA,col=prm$grid.col)
250
      grid(nx=NULL,ny=NA,col=prm$grid.col)
250
    } else
251
    } else
251
    {
252
    {
252
      abline(v=prm$grid.v, lty="dotted", col=prm$grid.col)
253
      abline(v=prm$grid.v, lty="dotted", col=prm$grid.col)
253
    }
254
    }
254
  }
255
  }
255
 
256
 
256
  if( !is.na(prm$grid.h) ){
257
  if( !is.na(prm$grid.h) ){
257
    if(prm$grid.h=="Def"){
258
    if(prm$grid.h=="Def"){
258
      grid(nx=NA,ny=NULL,col=prm$grid.col)
259
      grid(nx=NA,ny=NULL,col=prm$grid.col)
259
    }else{
260
    }else{
260
      abline(h=prm$grid.h, lty="dotted", col=prm$grid.col)}
261
      abline(h=prm$grid.h, lty="dotted", col=prm$grid.col)}
261
    }
262
    }
262
 
263
 
263
### Now, grid has bee drawn. Then contents can be added.
264
### Now, grid has bee drawn. Then contents can be added.
264
 ## add support for more cases! 
265
 ## add support for more cases! 
265
  if(!is.null(addcase)){
266
  if(!is.null(addcase)){
266
    if(addcase=="plotxy") {
267
    if(addcase=="plotxy") {
267
      bdpoints(x, y,
268
      bdpoints(x, y,
268
               type=type,
269
               type=type,
269
               cex=cex.plot,
270
               cex=cex.plot,
270
               xlim=xlim,
271
               xlim=xlim,
271
               ylim=ylim,
272
               ylim=ylim,
272
               col=col,
273
               col=col,
273
               ...)
274
               ...)
274
    } else if (addcase=="plotx"){
275
    } else if (addcase=="plotx"){
275
      bdpoints(x, y,
276
      bdpoints(x, y,
276
               type=type,
277
               type=type,
277
               cex=cex.plot,
278
               cex=cex.plot,
278
               xlim=xlim,
279
               xlim=xlim,
279
               ylim=ylim,
280
               ylim=ylim,
280
               col=col,
281
               col=col,
281
               ...)
282
               ...)
282
    }
283
    }
283
  }
284
  }
284
 
285
 
285
### Axis stuff This part should be improved. A function that draws
286
### Axis stuff This part should be improved. A function that draws
286
### axis should be run for all four axis. And it should be possible to
287
### axis should be run for all four axis. And it should be possible to
287
### supply whatever vector to base it on (especially relevant for
288
### supply whatever vector to base it on (especially relevant for
288
### taxis and raxis). What about colors?
289
### taxis and raxis). What about colors?
289
  
290
  
290
  ## this is because the use of mgp gives a ridiculous warning when too small
291
  ## this is because the use of mgp gives a ridiculous warning when too small
291
  options(warn=-1)
292
  options(warn=-1)
292
  if(draw.xaxis=="fun"){
293
  if(draw.xaxis=="fun"){
293
    xaxt.fun(xaxt.in)
294
    xaxt.fun(xaxt.in)
294
  } else if(draw.xaxis){
295
  } else if(draw.xaxis){
295
    ## is the abscissa a time object?
296
    ## is the abscissa a time object?
296
    if( "POSIXt"%in%class(x[1])){
297
    if( "POSIXt"%in%class(x[1])){
297
      axis.POSIXct(1, x,mgp=prm$mgp.xaxis, lwd=prm$lwd)
298
      axis.POSIXct(1, x,mgp=prm$mgp.xaxis, lwd=prm$lwd)
298
    } else {
299
    } else {
299
      axis(1, mgp=prm$mgp.xaxis, lwd=prm$lwd)
300
      axis(1, mgp=prm$mgp.xaxis, lwd=prm$lwd)
300
    }
301
    }
301
    
302
    
302
  }
303
  }
303
 
304
 
304
  if(draw.yaxis){ axis(2, y,mgp=prm$mgp.yaxis, lwd=prm$lwd) }
305
  if(draw.yaxis){ axis(2, y,mgp=prm$mgp.yaxis, lwd=prm$lwd) }
305
  ## top axis
306
  ## top axis
306
  if(prm$draw.taxis){ axis(3, mgp=prm$mgp.taxis, lwd=prm$lwd) }
307
  if(prm$draw.taxis){ axis(3, mgp=prm$mgp.taxis, lwd=prm$lwd) }
307
  ## axis to the right
308
  ## axis to the right
308
  if(prm$draw.raxis){ axis(4, mgp=prm$mgp.raxis, lwd=prm$lwd) }
309
  if(prm$draw.raxis){ axis(4, mgp=prm$mgp.raxis, lwd=prm$lwd) }
309
 
310
 
310
  ## switch back on warnings
311
  ## switch back on warnings
311
  options(warn=0)
312
  options(warn=0)
312
 
313
 
313
 
314
 
314
  ##Title stuff
315
  ##Title stuff
315
  ## Hvorfor??
316
  ## Hvorfor??
316
  scale <- 1
317
  scale <- 1
317
 
318
 
318
 
319
 
319
  if( !is.na(prm$tlab) ){
320
  if( !is.na(prm$tlab) ){
320
    mtext(prm$tlab, side=3, line=0.25, cex=prm$cex.lab/scale)
321
    mtext(prm$tlab, side=3, line=0.25, cex=prm$cex.lab/scale)
321
  }
322
  }
322
  if( !is.na(prm$rlab) ){
323
  if( !is.na(prm$rlab) ){
323
    mtext(prm$rlab, side=4, line=0.75, cex=prm$cex.lab/scale,mgp=prm$mgp.raxis)
324
    mtext(prm$rlab, side=4, line=0.75, cex=prm$cex.lab/scale,mgp=prm$mgp.raxis)
324
  }
325
  }
325
}
326
}
326
 
327
 
327
 
328
 
328
 
329