Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7e59e29

Browse filesBrowse files
authored
Merge pull request #19024 from anntzer/gsd
Dedupe docs of GridSpec.subplots.
2 parents d786d6a + 5c036aa commit 7e59e29
Copy full SHA for 7e59e29

File tree

Expand file treeCollapse file tree

2 files changed

+6
-56
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+6
-56
lines changed

‎lib/matplotlib/figure.py

Copy file name to clipboardExpand all lines: lib/matplotlib/figure.py
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,9 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False,
887887
first column subplot are created. To later turn other subplots'
888888
ticklabels on, use `~matplotlib.axes.Axes.tick_params`.
889889
890+
When subplots have a shared axis that has units, calling
891+
`.Axis.set_units` will update each axis with the new units.
892+
890893
squeeze : bool, default: True
891894
- If True, extra dimensions are squeezed out from the returned
892895
array of Axes:

‎lib/matplotlib/gridspec.py

Copy file name to clipboardExpand all lines: lib/matplotlib/gridspec.py
+3-56Lines changed: 3 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -266,61 +266,7 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True,
266266
"""
267267
Add all subplots specified by this `GridSpec` to its parent figure.
268268
269-
This utility wrapper makes it convenient to create common layouts of
270-
subplots in a single call.
271-
272-
Parameters
273-
----------
274-
sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
275-
Controls sharing of properties among x (*sharex*) or y (*sharey*)
276-
axes:
277-
278-
- True or 'all': x- or y-axis will be shared among all subplots.
279-
- False or 'none': each subplot x- or y-axis will be independent.
280-
- 'row': each subplot row will share an x- or y-axis.
281-
- 'col': each subplot column will share an x- or y-axis.
282-
283-
When subplots have a shared x-axis along a column, only the x tick
284-
labels of the bottom subplot are created. Similarly, when subplots
285-
have a shared y-axis along a row, only the y tick labels of the
286-
first column subplot are created. To later turn other subplots'
287-
ticklabels on, use `~matplotlib.axes.Axes.tick_params`.
288-
289-
When subplots have a shared axis that has units, calling
290-
`~matplotlib.axis.Axis.set_units` will update each axis with the
291-
new units.
292-
293-
squeeze : bool, optional, default: True
294-
- If True, extra dimensions are squeezed out from the returned
295-
array of Axes:
296-
297-
- if only one subplot is constructed (nrows=ncols=1), the
298-
resulting single Axes object is returned as a scalar.
299-
- for Nx1 or 1xM subplots, the returned object is a 1D numpy
300-
object array of Axes objects.
301-
- for NxM, subplots with N>1 and M>1 are returned as a 2D array.
302-
303-
- If False, no squeezing at all is done: the returned Axes object
304-
is always a 2D array containing Axes instances, even if it ends
305-
up being 1x1.
306-
307-
subplot_kw : dict, optional
308-
Dict with keywords passed to the `~.Figure.add_subplot` call used
309-
to create each subplot.
310-
311-
Returns
312-
-------
313-
ax : `~.axes.Axes` object or array of Axes objects.
314-
*ax* can be either a single `~matplotlib.axes.Axes` object or
315-
an array of Axes objects if more than one subplot was created. The
316-
dimensions of the resulting array can be controlled with the
317-
squeeze keyword, see above.
318-
319-
See Also
320-
--------
321-
.pyplot.subplots
322-
.Figure.add_subplot
323-
.pyplot.subplot
269+
See `.Figure.subplots` for detailed documentation.
324270
"""
325271

326272
figure = self.figure
@@ -337,7 +283,8 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True,
337283
# `subplots(1, 2, 1)` when `subplot(1, 2, 1)` was intended.
338284
# In most cases, no error will ever occur, but mysterious behavior
339285
# will result because what was intended to be the subplot index is
340-
# instead treated as a bool for sharex.
286+
# instead treated as a bool for sharex. This check should go away
287+
# once sharex becomes kwonly.
341288
if isinstance(sharex, Integral):
342289
cbook._warn_external(
343290
"sharex argument to subplots() was an integer. Did you "

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.