[R] postscript bounding box in trellis/lattice plot is wrong ?

context grey mobygeek at yahoo.com
Wed Mar 1 23:10:57 CET 2006


Hi,  a problem involving postscript bounding boxes:

I'm composing three scatterplots into a single figure,
postsript for publication.

The individual scatterplots should be square, so
the overall figure should have a roughly 1:3 sort of
aspect ratio.

By default however, the overall figure comes out
nearly square,
and the scatterplots are stretched vertically.

I fixed this by adding "aspect=1/1" to the individual
xyplot()
calls.  This produces a figure that looks correct.
 
However, the bounding box for the figure leaves way
too much
space above and below... as if it is still assuming
that the
figure is square rather than 1:3 in proportions.


Is there any fix for this?   Thanks for any advice

Here's the approximate code (very simple):
------------------------------------

library(lattice)

    plt_hi[[1]] <- xyplot(thedat[,ir] ~ thedat[,ic],
aspect=1/1)
...
    plt_hi[[2]] <- xyplot(thedat[,ir] ~ thedat[,ic],
aspect=1/1)
...
    plt_hi[[2]] <- xyplot(thedat[,ir] ~ thedat[,ic],
aspect=1/1)

trellis.device(postscript, file=thefile, color=F)
print(plt_hi[[1]], split=c(1,1,3,1), more=T)
print(plt_hi[[2]], split=c(2,1,3,1), more=T)
print(plt_hi[[3]], split=c(3,1,3,1), more=F)
dev.off()




More information about the R-help mailing list