Equal axes using quiver

Carol -

The ax.set_xlim and ax.set_ylim functions are ignoring the ‘equal’ status; not sure why, or whether that is wrong .
But since you are already using pylab, there is a much easier way that does work.
After your plot(4cos(an),4sin(an)) command, simply type

axis(‘equal’)
axis((xmin,xmax,ymin,ymax)) (both -5 and +5 I guess)

and it will work as expected.

If you insist on working the way you were, you have to use the right order, and fix the limits:

ax.set_xlim(-5, 5)
ax.set_ylim(-5, 5)
ax.set_aspect(‘equal’,fixLimits=True)

Mark

···

Hi folks,

I am trying to use quiver with equal axes. I have not been successful.
I suspect it is something simple such as not grabbing the correct axes.

If I use figure(figsize(7,7)), the plot seems to be a square, but it is
not. This is apparent when I run the script using:
python quiver6.py -dPS
and make two printouts which I then overlay with one rotated by 90 degrees.

I am using matplotlib 0.87.1 with numarray and GTKAgg backend.

Here is my code:

from pylab import *

an = linspace(0,2*pi,100)

X,Y = meshgrid( arange(-pi,pi,.2),arange(-pi

,pi,.2) )
U = cos(X)
V = sin(Y)

#figure(figsize=(7,7))
quiver( X,Y, U, V, color=True )
plot(4cos(an),4sin(an))
ax = gca() # Return the current axes
ax.set_aspect(‘equal’)
ax.set_xlim(-5, 5)

ax.set_ylim(-5, 5)

savefig(‘quiver6’, orientation = ‘landscape’)


Ms. Carol A. Leger
SRI International Phone: (650) 859-4114
333 Ravenswood Avenue G-273
Menlo Park, CA 94025 e-mail: leger@…392…