Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 05e17af

Browse files
authored
Merge pull request #17333 from anntzer/subplotskwo
Make sharex, etc. args of subplots() keyword-only.
2 parents de03d41 + 3d4400b commit 05e17af

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

doc/api/api_changes_3.3/deprecations.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,11 @@ The qt4agg and qt4cairo backends are deprecated.
438438
*fontdict* and *minor* parameters of `.Axes.set_xticklabels` and `.Axes.set_yticklabels` will become keyword-only
439439
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
440440

441+
All parameters of `.Figure.subplots` except *nrows* and *ncols* will become keyword-only
442+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
443+
This avoids typing e.g. ``subplots(1, 1, 1)`` when meaning ``subplot(1, 1, 1)``,
444+
but actually getting ``subplots(1, 1, sharex=1)``.
445+
441446
``RendererWx.get_gc``
442447
~~~~~~~~~~~~~~~~~~~~~
443448
This method is deprecated. Access the ``gc`` attribute directly instead.

lib/matplotlib/figure.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,7 @@ def _add_axes_internal(self, key, ax):
14301430
ax.stale_callback = _stale_figure_callback
14311431
return ax
14321432

1433+
@cbook._make_keyword_only("3.3", "sharex")
14331434
def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
14341435
squeeze=True, subplot_kw=None, gridspec_kw=None):
14351436
"""

lib/matplotlib/gridspec.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ def _normalize(key, size, axis): # Includes last index.
235235

236236
return SubplotSpec(self, num1, num2)
237237

238-
def subplots(self, sharex=False, sharey=False, squeeze=True,
238+
def subplots(self, *, sharex=False, sharey=False, squeeze=True,
239239
subplot_kw=None):
240240
"""
241241
Add all subplots specified by this `GridSpec` to its parent figure.

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,7 @@ def subplot(*args, **kwargs):
10841084
return ax
10851085

10861086

1087+
@cbook._make_keyword_only("3.3", "sharex")
10871088
def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True,
10881089
subplot_kw=None, gridspec_kw=None, **fig_kw):
10891090
"""

0 commit comments

Comments
 (0)