Skip to content

Commit 8ce6b67

Browse files
committed
bug: xlim, ylim with no arguments should not affect autoscaling
svn path=/branches/v1_0_maint/; revision=8953
1 parent 9e89b76 commit 8ce6b67

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/matplotlib/pyplot.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,10 +1054,14 @@ def xlim(*args, **kwargs):
10541054
xlim(xmax=3) # adjust the max leaving min unchanged
10551055
xlim(xmin=1) # adjust the min leaving max unchanged
10561056
1057+
Setting limits turns autoscaling off for the x-axis.
1058+
10571059
The new axis limits are returned as a length 2 tuple.
10581060
10591061
"""
10601062
ax = gca()
1063+
if not args and not kwargs:
1064+
return ax.get_xlim()
10611065
ret = ax.set_xlim(*args, **kwargs)
10621066
draw_if_interactive()
10631067
return ret
@@ -1077,9 +1081,13 @@ def ylim(*args, **kwargs):
10771081
ylim(ymax=3) # adjust the max leaving min unchanged
10781082
ylim(ymin=1) # adjust the min leaving max unchanged
10791083
1084+
Setting limits turns autoscaling off for the y-axis.
1085+
10801086
The new axis limits are returned as a length 2 tuple.
10811087
"""
10821088
ax = gca()
1089+
if not args and not kwargs:
1090+
return ax.get_ylim()
10831091
ret = ax.set_ylim(*args, **kwargs)
10841092
draw_if_interactive()
10851093
return ret

0 commit comments

Comments
 (0)