Line 6... |
Line 6... |
6 |
|
6 |
|
7 |
bdopen <- function(file=bdp()$file,paper=bdp()$paper,mfrow=bdp()$mfrow)
|
7 |
bdopen <- function(file=bdp()$file,paper=bdp()$paper,mfrow=bdp()$mfrow)
|
8 |
{
|
8 |
{
|
9 |
.bdcalcsizes(paper=paper)
|
9 |
.bdcalcsizes(paper=paper)
|
10 |
prm <- .bdgetpars()
|
10 |
prm <- .bdgetpars()
|
11 |
if( !is.na(prm$file) )
|
11 |
if( !is.na(file) )
|
12 |
{
|
12 |
{
|
13 |
## If figdir is supplied, prepending it to filename.
|
13 |
## If figdir is supplied, prepending it to filename.
|
14 |
if(!is.null(prm$figdir)&!is.na(prm$figdir))
|
14 |
if(!is.null(prm$figdir)&!is.na(prm$figdir))
|
15 |
{
|
15 |
{
|
16 |
prm$file <- paste(prm$figdir,prm$file,sep="")
|
16 |
file <- paste(prm$figdir,file,sep="")
|
17 |
}
|
17 |
}
|
18 |
## determining device driver from filename
|
18 |
## determining device driver from filename
|
19 |
nchars <- nchar(prm$file)
|
19 |
nchars <- nchar(file)
|
20 |
|
20 |
|
21 |
if( any( substr(prm$file,nchars-2,nchars)==".ps",substr(prm$file,nchars-3,nchars)==".eps")){
|
21 |
if( any( substr(file,nchars-2,nchars)==".ps",substr(file,nchars-3,nchars)==".eps")){
|
22 |
m <- {
|
22 |
m <- {
|
23 |
cat("B/D plotting writing to postscript file\n")
|
23 |
cat("B/D plotting writing to postscript file\n")
|
24 |
postscript(file=prm$file, width=prm$width, height=prm$height, paper="special", family = "Helvetica", horizontal=FALSE)
|
24 |
postscript(file=file, width=prm$width, height=prm$height, paper="special", family = "Helvetica", horizontal=FALSE)
|
25 |
}
|
25 |
}
|
26 |
} else if ( substr(prm$file,nchars-3,nchars)==".pdf")
|
26 |
} else if ( substr(file,nchars-3,nchars)==".pdf")
|
27 |
{
|
27 |
{
|
28 |
pdf(file=prm$file, width=prm$width, height=prm$height, paper="special",family = "Helvetica")
|
28 |
pdf(file=file, width=prm$width, height=prm$height, paper="special",family = "Helvetica")
|
29 |
} else if (any(substr(prm$file,nchars-3,nchars)==".jpg", substr(prm$file,nchars-4,nchars)==".jpeg")) {
|
29 |
} else if (any(substr(file,nchars-3,nchars)==".jpg", substr(file,nchars-4,nchars)==".jpeg")) {
|
30 |
cat("Writing to jpeg file\n")
|
30 |
cat("Writing to jpeg file\n")
|
31 |
jpeg(filename=prm$file,width=prm$width,height=prm$height,units=prm$size.unit,quality=prm$jpeg.quality,res=prm$jpeg.res,type="cairo")
|
31 |
jpeg(filename=file,width=prm$width,height=prm$height,units=prm$size.unit,quality=prm$jpeg.quality,res=prm$jpeg.res,type="cairo")
|
32 |
### bitmap(file=prm$file,type="jpeg",width=prm$width,height=prm$height,units=prm$size.unit,res=prm$jpeg.res,pointsize=.3)
|
32 |
### bitmap(file=file,type="jpeg",width=prm$width,height=prm$height,units=prm$size.unit,res=prm$jpeg.res,pointsize=.3)
|
33 |
}
|
33 |
}
|
34 |
}
|
34 |
}
|
35 |
else {
|
35 |
else {
|
36 |
## to X. Note that this doesn't work on win and osx.
|
36 |
## to X. Note that this doesn't work on win and osx.
|
37 |
X11(height=prm$height*2,width=prm$width*2)
|
37 |
X11(height=prm$height*2,width=prm$width*2)
|