Skip to content

Commit 36d9e9a

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 ff2ca03 commit 36d9e9a

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
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/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)