Subversion Repositories bdplot

Rev

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

Rev 34 Rev 35
Line 6... Line 6...
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
                   xaxt=bdp()$xaxt,yaxt=bdp()$yaxt,
10
                   xaxt=bdp()$xaxt,yaxt=bdp()$yaxt,
-
 
11
                   xaxt.in=NULL,yaxt.in=NULL,
11
                   xlab=bdp()$xlab, ylab=bdp()$ylab,
12
                   xlab=bdp()$xlab, ylab=bdp()$ylab,
12
                   xlim=NULL,ylim=NULL,
13
                   xlim=NULL,ylim=NULL,
13
                   col=bdp()$col,main=NULL,
14
                   col=bdp()$col,main=NULL,
14
                   ## only used in case of plot mode
15
                   ## only used in case of plot mode
15
                   type=bdp()$type,
16
                   type=bdp()$type,
Line 35... Line 36...
35
  par(mar=mar)
36
  par(mar=mar)
36
 
37
 
37
  par(mgp=prm$mgp.global)
38
  par(mgp=prm$mgp.global)
38
  
39
  
39
### xaxt and yaxt can be set to "axis" which is the special case where the axis is drawn with the axius
40
### xaxt and yaxt can be set to "axis" which is the special case where the axis is drawn with the axius
-
 
41
  if(class(xaxt)=="function") {
-
 
42
 
-
 
43
    if(prm$debug)
-
 
44
      print(class(x))
-
 
45
    if(is.null(xaxt.in)){
-
 
46
      xinterval <- x
-
 
47
    } else {
-
 
48
      xinterval <- xax.in
-
 
49
    }
-
 
50
    draw.xaxis <- "fun"
-
 
51
    xaxt.fun <- xaxt
-
 
52
    xaxt <- "n"
40
  if(xaxt=="axis"){
53
  } else if(xaxt=="axis"){
41
    xaxt <- "n"
54
    xaxt <- "n"
42
    draw.xaxis <- TRUE
55
    draw.xaxis <- TRUE
43
  } else {
56
  } else {
44
    draw.xaxis <- FALSE
57
    draw.xaxis <- FALSE
45
  }
58
  }
-
 
59
  if(class(yaxt)=="function") {
-
 
60
    yaxt(ifelse(is.null(yaxt.in),range(y),yaxt.in))
-
 
61
    draw.yaxis <- FALSE
46
  if(yaxt=="axis"){
62
  } else if(yaxt=="axis"){
47
    yaxt <- "n"
63
    yaxt <- "n"
48
    draw.yaxis <- TRUE
64
    draw.yaxis <- TRUE
49
  } else {
65
  } else {
50
    draw.yaxis <- FALSE
66
    draw.yaxis <- FALSE
51
  }
67
  }
Line 188... Line 204...
188
### supply whatever vector to base it on (especially relevant for
204
### supply whatever vector to base it on (especially relevant for
189
### taxis and raxis)
205
### taxis and raxis)
190
  
206
  
191
  ## this is because the use of mgp gives a ridiculous warning when too small
207
  ## this is because the use of mgp gives a ridiculous warning when too small
192
  options(warn=-1)
208
  options(warn=-1)
193
  if(draw.xaxis){
209
  if(draw.xaxis=="fun"){
194
    ##    mgp.old <- par()$mgp
210
    xaxt.fun(xinterval)
195
    ##    par(mgp) <- mgp.xaxis
211
  } else if(draw.xaxis){
196
    ## is the abscissa a time object?
212
    ## is the abscissa a time object?
197
    if( "POSIXt"%in%class(x[1])){
213
    if( "POSIXt"%in%class(x[1])){
198
      axis.POSIXct(1, x,mgp=prm$mgp.xaxis, lwd=prm$lwd)
214
      axis.POSIXct(1, x,mgp=prm$mgp.xaxis, lwd=prm$lwd)
199
    } else {
215
    } else {
200
      axis(1, mgp=prm$mgp.xaxis, lwd=prm$lwd)
216
      axis(1, mgp=prm$mgp.xaxis, lwd=prm$lwd)