Skip to content

Commit bd64d50

Browse files
committed
Make emit and auto args of set_{x,y,z}lim keyword only.
This should help with later improving argument checking in the setters, e.g. to make `set_xlim(3)` error out (requiring `set_xlim(left=3)`), as that is likely a logic error.
1 parent 99de892 commit bd64d50

File tree

4 files changed

+9
-1
lines changed

4 files changed

+9
-1
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*emit* and *auto* parameters of ``set_xlim``, ``set_ylim``, ``set_zlim``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
Passing these parameters positionally is deprecated; they will become
4+
keyword-only in a future release.

lib/matplotlib/axes/_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3625,6 +3625,7 @@ def _validate_converted_limits(self, limit, convert):
36253625
raise ValueError("Axis limits cannot be NaN or Inf")
36263626
return converted_limit
36273627

3628+
@_api.make_keyword_only("3.6", "emit")
36283629
def set_xlim(self, left=None, right=None, emit=True, auto=False,
36293630
*, xmin=None, xmax=None):
36303631
"""
@@ -3897,6 +3898,7 @@ def get_ylim(self):
38973898
"""
38983899
return tuple(self.viewLim.intervaly)
38993900

3901+
@_api.make_keyword_only("3.6", "emit")
39003902
def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
39013903
*, ymin=None, ymax=None):
39023904
"""

lib/matplotlib/projections/polar.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1227,7 +1227,8 @@ def set_ylim(self, bottom=None, top=None, emit=True, auto=False,
12271227
bottom, top : (float, float)
12281228
The new y-axis limits in data coordinates.
12291229
"""
1230-
return super().set_ylim(bottom, top, emit, auto, ymin=ymin, ymax=ymax)
1230+
return super().set_ylim(
1231+
bottom, top, emit=emit, auto=auto, ymin=ymin, ymax=ymax)
12311232

12321233
def get_rlabel_position(self):
12331234
"""

lib/mpl_toolkits/mplot3d/axes3d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ def get_w_lims(self):
660660
return minx, maxx, miny, maxy, minz, maxz
661661

662662
# set_xlim, set_ylim are directly inherited from base Axes.
663+
@_api.make_keyword_only("3.6", "emit")
663664
def set_zlim(self, bottom=None, top=None, emit=True, auto=False,
664665
*, zmin=None, zmax=None):
665666
"""

0 commit comments

Comments
 (0)