Well, I think the meaning of the axis("equal") is a bit misleading (at
least to me), but if you look at the documentation, it says that it
changes the xlimit and ylimit (limits in data coordinate), so this is
NOT what you want.
What you need is axis("scaled") or axis("image").
With this, you will have square axes regardless of the figure size or
subplot params (assuming that the x- and y- data limits are same).
On Sun, Jul 26, 2009 at 8:43 PM, kbkb<kblack@...> wrote:
> Thanks for trying to help Andreas.
> Those suggestions did not really solve the problem, but I did realize where
> I was going astray and post that information here to help others. I did see
> others new to the libraries looking for similar help.
> First the conceptual misunderstanding: I did not realize the 'figure size',
> as set by something like
> plt.gcf().set_size_inches(6,6) includes all area: white plot area, grey
> surrounding area, labels, etc. Everything inside the window frame. A bad
> coincidence slowed my realization. I measured the white area inside the
> axis to be 480x464 pixels, which at 80 dpi worked almost for a 6x6. So, I
> thought it was close but off just a bit. But, I had set the dpi to 100, and
> the total frame was exactly 600x600 as it should be. The dimensions of the
> plot area inside the axes was being set automatically, and just
> coincidentally worked out to be 480 in one dimension.
> Solution to get truly square plots of known size with axis scale set:
> fig = plt.gcf()
> fig.set_dpi(100) # or whatever you like
> fig.set_size_inches((6.0,6.0),forward=True) #for example
> # to control the fraction of the total area set aside for axis tick mark
> labels, etc.
> # this is key to keeping the interior plot area square
> ## plt.axis('equal') # I had this for a while but do not think it
> # to keep the axis scale from being automatically changed as line2d
> objects are added or removed
> plt.axis([1.0,9.0,1.0,9.0]) # set the axis scale as appropriate
> View this message in context: http://www.nabble.com/square-plots-with-linear-equal-axes-----help-tp24638812p24672100.html
> Sent from the matplotlib - users mailing list archive at Nabble.com.
> Matplotlib-users mailing list