|
From: Alan G I. <ai...@am...> - 2004-09-20 13:38:20
|
On Tue, 14 Sep 2004, John Hunter apparently wrote:
> def square():
> fig = gcf()
> ax = gca()
> figw, figh = fig.get_size_inches()
> l,b,axw,axh = ax.get_position()
> side = min([figw, figh])
> frac = min([axw, axh])
> fig.set_figsize_inches(side, side)
> ax.set_position([l,b,frac,frac])
> axis('equal')
> draw()
OK, this does not work for me.
Test case:
d=arange(201)*pi/100
plot(cos(d),sin(d))
square()
show()
This should look like a circle.
It looks like an oval.
Problems:
1. fig.set_figsize_inches is ignored.
It has no effect on figure size.
(It changes the size the figure reports,
as checked by printing it, but not the
size that is drawn---a missing argument
to draw?)
2. axis('equal') should not be desirable,
if it is matlab compatible
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/axis.html
That is, square() should set an axis aspect ratio of unity,
but axis('equal') should equate the *unit length* along each
axis. (For my example circle this is not a problem, but in
generaly this is completely wrong.)
Hope that's useful,
Alan Isaac
|