Skip to content
Browse files

Fix bug in axis(): if called with no args or kwargs, don't change aut…

…oscale.

Bug reported by Joe Kington.
  • Loading branch information...
1 parent ffd4581 commit 0cc213b4fa748cd0dd7557a7dbcf8fb0bac2cb19 @efiring efiring committed May 14, 2011
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/matplotlib/axes.py
View
9 lib/matplotlib/axes.py
@@ -1239,11 +1239,17 @@ def apply_aspect(self, position=None):
def axis(self, *v, **kwargs):
'''
Convenience method for manipulating the x and y view limits
- and the aspect ratio of the plot.
+ and the aspect ratio of the plot. For details, see
+ :func:`~matplotlib.pyplot.axis`.
*kwargs* are passed on to :meth:`set_xlim` and
:meth:`set_ylim`
'''
+ if len(v) == 0 and len(kwargs) == 0:
+ xmin, xmax = self.get_xlim()
+ ymin, ymax = self.get_ylim()
+ return xmin, xmax, ymin, ymax
+
if len(v)==1 and is_string_like(v[0]):
s = v[0].lower()
if s=='on': self.set_axis_on()
@@ -1289,7 +1295,6 @@ def axis(self, *v, **kwargs):
if len(v) != 4:
raise ValueError('v must contain [xmin xmax ymin ymax]')
-
self.set_xlim([v[0], v[1]])
self.set_ylim([v[2], v[3]])

0 comments on commit 0cc213b

Please sign in to comment.
Something went wrong with that request. Please try again.