# [SciPy-user] Plotting with PyLab

Nuttall, Brandon C bnuttall@uky....
Thu Oct 25 08:46:11 CDT 2007

```Thanks Dominique. I was looking at the docstrings of the pylab objects to see if I could figure out how to invert the axes (I did). I found that axis() has an argument that works.

import pylab
pylab.figure(1)
pylab.axis('equal')
...

Brandon

[cid:image001.jpg@01C816EB.E0508C80]
________________________________
From: scipy-user-bounces@scipy.org [mailto:scipy-user-bounces@scipy.org] On Behalf Of Dominique Orban
Sent: Wednesday, October 24, 2007 5:46 PM
To: SciPy Users List
Subject: Re: [SciPy-user] Plotting with PyLab

On 10/24/07, Nuttall, Brandon C <bnuttall@uky.edu<mailto:bnuttall@uky.edu>> wrote:

I'd like to make a plot (graph) where the x and y units have the same scale. That is, one unit in the x direction is the same physical size as 1 unit in the y direction; circles will be circles and squares squares. What I'm doing is I'm given a path through 3d space. At a given distance, MD, along that path I am supplied an azimuth (the departure from vertical) and a bearing. I can translate these data to (x,y,z).

What I want to do is make three maps showing the trajectory of the path: XY space, XZ space, and YZ space. At this time, a 3D visualization is not needed and, in actuality, only the XY plot is required.

If pylab is not right, suggestions on what module I should use is appreciated.

Hi Brandon,

If I understand well, what you're looking for is something like this:

import pylab
fig = pylab.figure()    # Create a figure
ax = fig.gca()             # Obtain axes in the current figure
ax.plot( [0,1], [0,0], 'k-' )   # Plot the [0,1] x [0,1] square
ax.plot( [0,0], [0,1], 'k-' )
ax.plot( [0,1], [1,1], 'k-' )
ax.plot( [1,1], [0,1], 'k-' )
ax.set_xlim( [-0.3,1.3] )   # Adjust x and y range
ax.set_ylim( [-0.3,1.3] )
ax.set_aspect('equal')   # Make aspect ratio equal to 1
pylab.show()

and that should produce a square that indeed looks square and not rectangular.

Dominique

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/scipy-user/attachments/20071025/2b2c796e/attachment-0001.html
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 17011 bytes
Desc: image001.jpg
Url : http://projects.scipy.org/pipermail/scipy-user/attachments/20071025/2b2c796e/attachment-0001.jpg
```