Subversion Repositories bdplot

Rev

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

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