but if you use axis only without redefine gca limit that
> don't work:
> from pylab import * from matplotlib.patches import
> Rectangle axis([0,10],[0,10]) ax = gca() p =
> Rectangle((1,1),3,3,fill=False) ax.add_patch(p)
I think you screwed up the "axis" syntax. What you mean (I think) is:
from pylab import *
from matplotlib.patches import Rectangle
axis([0,10,0,10])
ax = gca()
p = Rectangle((1,1),3,3,fill=False)
ax.add_patch(p)
show()
> I understand that gca return an instance but perhaps that
> will be a good idea if by default that will use the axis
> of the courrant figure and not [0,1,0,1].
I'm a little confused here. gca returns the current axes (note axis
and axes are different commands and have different meanings). The
default axes is
2 >>> ax = gca()
3 >>> ax.get_position()
Out[3]: [0.125, 0.10999999999999999, 0.77500000000000002, 0.79000000000000004]
Can you clarify your meaning? axis set the view limits of the current
axes. The view limits are in data coordinates, and these are the same
limits that are controlled by xlim and ylim. axes sets the position
of the axes (the frame in which your plots are made) and these
coordinates are in figure coords -- 0,0 is lower left of the figure
and 1,1 is upper right.
JDH