[R] How to get correct proportions/bounding box for latex figure?

context grey mobygeek at yahoo.com
Wed Mar 15 03:29:04 CET 2006

Thank you.   However I don't think I understand the
response here.

In what sense do I "want a nonstandard layout"?  

Is because I am specify aspect=1/1 in the xyplot() ?  

If so, then is there some other way to cause the
to be rougly square?  I took this out and looked at
the result again.
Rougly estimating, the aspect ratio of each
scatterplot is about 7:1.
When a normal distribution is stretched to this extent
it looks like
a linear trend.   Very hard to read.

Alternately, my nonstandard layout may be the
specfication of 
width/height in the trellis.device() call?   But
without both of these
R gives the error mentioned in my original post.  
(And this
is the most puzzling point to me - I really
don't understand why both of these are required --
specifying one of them would serve usefully to scale
the plot
without changing its aspect ratio, and R should be
able to figure
out the aspect ratio since it is drawing the plot.)

The issue is not with Latex.  I'm using
graphicx/includegraphics, which
does not stretch figures unless requested.  I also
verified this
by opening the .eps in another program; it looks the
same as in latex.
Latex is correctly reading the bounding box, but the
bounding box
is quite wrong.

(May need to clarify here, there are two situations:  
1)  aspect=1/1 is not specified in the xyplot() call. 
Then the scatter
    plots come out hugely stretched.  The bounding box
may be correct.
2)  specify aspect=1/1.  Now the scatterplots are sort
of correct,
provided I can either guess what width/height should
be in trellis.device(), or else omit the
paper=special.  But the bounding
box is quite wrong, it is roughly square, whereas the
figure itself
should be roughly 3:1 for 3 square scatterplots).

Again, I think the problem is that I'm just
overlooking something basic, but cannot figure out
what it is.

Here's an idea:  maybe lattice/trellis doesn't handle
putting several
plots into a single figure (and same .eps file), i.e.
it should have 
separate device/plot/dev.off() calls for each figure? 
 And then 
I'd try to assemble the three into one using latex?

--- Duncan Murdoch <murdoch at stats.uwo.ca> wrote:

> You say you want a nonstandard layout, then you say
> you shouldn't have 
> to tell R what you want.  How else would it know?
> Regarding the stretching:  that's being done by
> whatever software is 
> importing the picture.  Just tell it to preserve the
> aspect ratio, and 
> things will be fine.  R writes the bounding box into
> EPS files, and 
> reasonable software should be able to read it from
> there.
> Duncan Murdoch

More information about the R-help mailing list