Subversion Repositories bdplot

Rev

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

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