From: Alan G I. <ai...@am...> - 2004-09-14 05:28:11
|
Alan G Isaac <ai...@am...> writes: >> So this is almost a feature request. The only problem is >> that gnuplot's size command does not seem obviously suited >> to the matplotlib.matlab model, and I'm not sure what a good >> version would be. I think it would be something like "get >> the current axis, keep the "long" axis (as implied by the >> ratio) full length, and "shrink" the shorter axis as >> necessary to achieve the right ratio. This would respect >> the existing margins to everywhere except by the shrinking >> axis. However it would probably be better to adjust the >> figure size as well, to keep the margins unchanged. On Mon, 13 Sep 2004, John Hunter apparently wrote: > I'm not fully understanding you, in part because I find the > terminology ambiguous. Could you give an example of what you want to > achieve (eg a scatterplot with a square viewing window). For > concreteness, we have > ylim / xlim : the data view limits > axh / axw : the axes height / width, relative coords 0-1 > figh / figw : the figure width and height in inches > dpiy / dpix : the display devices resolution in pixels in the > vertical and horizontal directions > In order to get true physical sizes and ratios, we need to know dpiy > and dpix. matplotlib currently only supports a single dpi, though it > is still possible to hack true sizes by adjusting for example, figh > and figw to compensate for variation in dpiy and dpix. In gnuplot if I want to set a compression ratio of unity for a figure that has an xrange of [xmin,xmax] and a yrange of [ymin,ymax], I just say set size ratio (ymax-ymin)/(xmax-xmin) So e.g. if I do this when I am plotting a function f:R->R then the unit size will be physically identical along each axis. So for example if I plot a circle it looks like a circle and not an oval. In a very clever move, gnuplot also allows set size ratio -1 to achieve the same effect. Crudely: I'm looking for something just as simple in matplotlib.matlab. My last post outlined what I think the current procedure is to achieve the same effect, and it is much more cumbersome. While this matters little when one is leisurely writing a script, it matters a lot when one is doing interactive plotting in a classroom setting. Now you point out that this request has an ambiguity: what "physical" medium am I talking about? Specifically, a true compression ratio on screen requires tricky stuff if dpiy != dpix. OK, I assume ignoring this will yield a "close enough" result in a classroom setting, so the only time I need it to be exact is when I produce figures for paper display. Hope that is clearer. Thank you, Alan Isaac |