On Tue, 2005-04-19 at 12:11 -0500, Deepayan Sarkar wrote: > On Tuesday 19 April 2005 11:40, Barry Rowlingson wrote: > > Marc Schwartz wrote: > > > # Set height value as you require > > > height <- 3 > > > X11(width = aspect * height, height = height) > > > .... > > > Does that get you what you need? > > > > I'm guessing that will work, but it just seems unsatisfactory, > > since if I resize my graphics window I mess it up. > > > > If I set par(pty='s') I can have a square plot floating inside a > > graphics window of any shape, I'd like to be able to plot something > > specifying ylim and asp and get a rectangular plot with a fixed > > aspect ratio floating around inside a resizable graphics device.... > > > > The 'aspect' ratio of xyplot (lattice package) lets you specify the > > aspect ratio of the plot (not relating to the data, ie aspect=1 draws > > a square plot whatever the ratio of X and Y range). Try this: > > > > xy=data.frame(x=c(0,21),y=c(0,4)) > > xyplot(y~x,data=xy,aspect=0.2) > > > > - now resize the graphics window and the plot keeps its ratio. > > That's the effect I was hoping to get from base graphics. > > > > I could use lattice graphics but I'd have to work out the value of > > 'aspect' to get the 1:1 aspect ratio for my data. I'm not sure this > > is trivial, since it may involve considering the various margins and > > spacing around a plot. > > Try (with a sufficiently recent version of R) > > xyplot(y~x, data=xy, aspect="iso") > > Is that what you want?
That looks like it would do it and as with Baz' example, it is resizable. Thanks Deepayan. Marc ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html