On Tue, 2005-04-19 at 17:40 +0100, 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.
Patient: "Doctor, when I move my arm like this it hurts." Doctor: "Well...stop moving your arm like that." ;-) I think that unlike your lattice example below, the X11 device is "elastic" on a resize. I do not see a par() setting that alters that behavior. For some reason, I think that under Windows there was a setting for the default Windows graphics device relative to resizing, but that my be the result of a TIA and not the representation of reality...I hate it when that happens. :-) > 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. > > Close... There is a fair amount of interaction there. I am not sure what might be a "best" approach. I'll think about it. If I come up with anything, I'll let you know. I guess that one underlying consideration I might think about here is, where is your final output going. If to a PS file for printing or inclusion in a LaTeX document, I would focus on how the plot looks there, especially when trying to compare it to X11 output. 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