axis aspect ratio

Thanks a lot! This worked like a charm. I’ll need to dig into matplotlib a lot later,

but now I have truckloads of bugs in my code to deal with, this will speed me up

significantly.

Thank you again,

Tomislav

···

----- Original Message -----

From: PHobson@…2792…

Sent: 03/15/10 05:40 PM

To: tomislav.maric@…3026…, matplotlib-users@lists.sourceforge.net

Subject: RE: [Matplotlib-users] axis aspect ratio

Give this a shot:

import matplotlib.pyplot as plt

fig = pl.figure(figsize=(4,4))

ax = fig.add_sublot(1,1,1) # tweak as needed

[plot your data]

ax.set_aspect(‘equal’)

http://matplotlib.sourceforge.net/api/axes_api.html?highlight=set_aspect#matplotlib.axes.Axes.set_aspect

From: tomislav_maric@…2537… [mailto:tomislav.maric@…2537…]
Sent: Monday, March 15, 2010 9:33 AM
To: matplotlib-users@lists.sourceforge.net
Subject: [Matplotlib-users] axis aspect ratio

Hello everyone,

I’m using matplotlib for plotting data results from numerical simulations that involve a lot of geometric calculations.

I did read the tutorial, but I haven’t been able to figure out the proper way to set the axis aspect ratio to “1” when

numerical data is plotted.

Here is an example of my plot:

http://img715.imageshack.us/img715/9318/projections.png

since I need the aspect ratio to be “1” so that I can visually inspect my numerical code for bugs, I would really

appreciate the help.

I’ve loaded the data using pylab.load and I’ve plotted the files without using figure or axes, just plain old

pyplot.