kbkb wrote:
> 
> Hi
> This should be so simple, but I have been struggling for a long time
> trying to create a square plot of exact dimensions (so a series of them
> can be overlaid later), with x and y axis limits identical and set by me
> (preferably without the plot limits updating automatically as I add or
> delete data, but that is a separate issue), while working interactively on
> a single plot using pyplot in ipython on OS X using the current enthought
> distribution.
> 
> with pyplot imported as plt,
> typical of what I have tried are many variations on 
> 
> plt.plot(*args)                                     with args a list of
> x,y sets
> fig = plt.gcf()
> fig.set_size_inches(6,6,forward='True')    to force a redraw
> ax = plt.gca()
> ax.grid(True)
> plt.axis([1.0,10.0,1.0,10.0])
> plt.draw()
> 
> Sometimes the x axis is set correctly, but the y axis is not, and is
> typically showing more range (approximately 0.8-10.1 for example),
> possibly because the plot is not square, though it is close, or because
> the scales are not equal.
> 
> I have tried adding 'equal' to the plt.axis command, 
> and entering the values as
> plt.axis(xmin=1.0,xmax=10.0,ymin=1.0,ymax=10.0)
> and entering just the first three and then
> plt.axis('equal')
> and I have tried working with 
> ax.set_aspect('equal')
> 
> But, I am truly lost as I try to sort out which elements are in control.
> Any help or leads would be greatly appreciated.  
> Scanning old archives and googling has not yet got me there.   
> 
> kersey
> 



Hi kersey,

maybe it helps if you set the figure size already while you inilialise it.
I use e.g.

--CODE--

fig =  figure(1,  figsize=(20,7),  dpi = 80)

--CODE--

to generate non squared plots. To make a square plot figsize have to be e.g
figsize=(10,10). But I do not know if this really works, maybe only the
figure has an equal aspect ratio and the real plot not. 

Otherwise you can set the plot aspect ratio = equal with
matplotlib.axes.Axes.set_aspect

Details can be found here:

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



Andreas

 



-- 
View this message in context: 
http://www.nabble.com/square-plots-with-linear-equal-axes-----help-tp24638812p24644304.html
Sent from the matplotlib - users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to