Rev 15 | Rev 24 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
### bdopen
### Used to open a graphics driver with BDplot.
### In X11, height and width are scaled to get a nicer window on the screen.
### This hack is ugly. At least there should be a scaling factor in stead so that all measures are scaled (fonts, etc).
bdopen <- function(file=bdp()$file,paper=bdp()$paper,mfrow=bdp()$mfrow)
{
.bdcalcsizes(paper=paper)
prm <- .bdgetpars()
if( !is.na(file) )
{
## If figdir is supplied, prepending it to filename.
if(!is.null(prm$figdir)&!is.na(prm$figdir))
{
file <- paste(prm$figdir,file,sep="")
}
## determining device driver from filename
nchars <- nchar(file)
if( any( substr(file,nchars-2,nchars)==".ps",substr(file,nchars-3,nchars)==".eps")){
m <- {
cat("B/D plotting writing to postscript file\n")
postscript(file=file, width=prm$width, height=prm$height, paper="special", family = "Helvetica", horizontal=FALSE)
}
} else if ( substr(file,nchars-3,nchars)==".pdf")
{
pdf(file=file, width=prm$width, height=prm$height, paper="special",family = "Helvetica")
} else if (any(substr(file,nchars-3,nchars)==".jpg", substr(file,nchars-4,nchars)==".jpeg")) {
cat("Writing to jpeg file\n")
jpeg(filename=file,width=prm$width,height=prm$height,units=prm$size.unit,quality=prm$jpeg.quality,res=prm$jpeg.res,type="cairo")
### bitmap(file=file,type="jpeg",width=prm$width,height=prm$height,units=prm$size.unit,res=prm$jpeg.res,pointsize=.3)
}
}
else {
## to X. Note that this doesn't work on win and osx.
X11(height=prm$height*2,width=prm$width*2)
}
par(mfrow=mfrow)
}