3
3
4
4
`Figure`
5
5
Top level `~matplotlib.artist.Artist`, which holds all plot elements.
6
- Many methods are implimented in `PanelBase `.
6
+ Many methods are implimented in `FigureBase `.
7
7
8
- `SubPanel `
8
+ `SubFigure `
9
9
A logical figure inside a figure, usually added to a figure (or parent
10
- `SubPanel `) with `Figure.add_subpanel ` or `Figure.subpanels ` methods
10
+ `SubFigure `) with `Figure.add_subfigure ` or `Figure.subfigures ` methods
11
11
(provisional API v3.4).
12
12
13
13
`SubplotParams`
@@ -219,9 +219,9 @@ def update(self, left=None, bottom=None, right=None, top=None,
219
219
self .hspace = hspace
220
220
221
221
222
- class PanelBase (Artist ):
222
+ class FigureBase (Artist ):
223
223
"""
224
- Base class for `.figure.Figure` and `.figure.SubPanel ` containing the
224
+ Base class for `.figure.Figure` and `.figure.SubFigure ` containing the
225
225
methods that add artists to the figure or panel, create axes, etc.
226
226
"""
227
227
def __init__ (self ):
@@ -1408,26 +1408,26 @@ def add_gridspec(self, nrows=1, ncols=1, **kwargs):
1408
1408
self ._gridspecs .append (gs )
1409
1409
return gs
1410
1410
1411
- def subpanels (self , nrows = 1 , ncols = 1 , squeeze = True ,
1411
+ def subfigures (self , nrows = 1 , ncols = 1 , squeeze = True ,
1412
1412
wspace = None , hspace = None ,
1413
1413
width_ratios = None , height_ratios = None ,
1414
1414
** kwargs ):
1415
1415
"""
1416
- Add a subpanel to this figure or subpanel . A subpanel has the same
1416
+ Add a subfigure to this figure or subfigure . A subfigure has the same
1417
1417
artist methods as a figure, and is logically the same as a figure.
1418
1418
1419
1419
Parameters
1420
1420
----------
1421
1421
nrows, ncols : int, default: 1
1422
- Number of rows/columns of the subpanel grid.
1422
+ Number of rows/columns of the subfigure grid.
1423
1423
1424
1424
squeeze : boolean, default: True
1425
1425
If True, extra dimensions are squeezed out from the returned
1426
- array of subpanels .
1426
+ array of subfigures .
1427
1427
1428
1428
wspace, hspace : float, default: None
1429
- The amount of width/height reserved for space between subpanels ,
1430
- expressed as a fraction of the average subpanel width.
1429
+ The amount of width/height reserved for space between subfigures ,
1430
+ expressed as a fraction of the average subfigure width.
1431
1431
If not given, the values will be inferred from a figure or
1432
1432
rcParams when necessary.
1433
1433
@@ -1449,20 +1449,20 @@ def subpanels(self, nrows=1, ncols=1, squeeze=True,
1449
1449
sfarr = np .empty ((nrows , ncols ), dtype = object )
1450
1450
for i in range (ncols ):
1451
1451
for j in range (nrows ):
1452
- sfarr [j , i ] = self .add_subpanel (gs [j , i ], ** kwargs )
1452
+ sfarr [j , i ] = self .add_subfigure (gs [j , i ], ** kwargs )
1453
1453
1454
1454
if squeeze :
1455
1455
# Discarding unneeded dimensions that equal 1. If we only have one
1456
- # subpanel , just return it instead of a 1-element array.
1456
+ # subfigure , just return it instead of a 1-element array.
1457
1457
return sfarr .item () if sfarr .size == 1 else sfarr .squeeze ()
1458
1458
else :
1459
1459
# Returned axis array will be always 2-d, even if nrows=ncols=1.
1460
1460
return sfarr
1461
1461
1462
1462
return sfarr
1463
1463
1464
- def add_subpanel (self , subplotspec , ** kwargs ):
1465
- sf = SubPanel (subplotspec , self , ** kwargs )
1464
+ def add_subfigure (self , subplotspec , ** kwargs ):
1465
+ sf = SubFigure (subplotspec , self , ** kwargs )
1466
1466
self .panels += [sf ]
1467
1467
return sf
1468
1468
@@ -1887,21 +1887,21 @@ def _set_artist_props(self, a):
1887
1887
a .set_transform (self .transPanel )
1888
1888
1889
1889
1890
- class SubPanel ( PanelBase ):
1890
+ class SubFigure ( FigureBase ):
1891
1891
"""
1892
- Logical panel that can be placed in a figure typically using
1893
- `.Figure.add_subpanel ` or `.SubPanel.add_subpanel `, or
1894
- `.SubPanel.subpanels `. A panel has the same methods as a figure
1892
+ Logical figure that can be placed inside a figure typically using
1893
+ `.Figure.add_subfigure ` or `.SubFigure.add_subfigure `, or
1894
+ `.SubFigure.subfigures `. A panel has the same methods as a figure
1895
1895
except for those particularly tied to the size or dpi of the figure, and
1896
1896
is confined to a prescribed region of the figure. For example the
1897
- following puts two subpanels side-by-side::
1897
+ following puts two subfigures side-by-side::
1898
1898
1899
1899
fig = plt.figure()
1900
- spanels = fig.subpanels (1, 2)
1901
- axsL = spanels [0].subplots(1, 2)
1902
- axsR = spanels [0].subplots(2, 1)
1900
+ sfigs = fig.subfigures (1, 2)
1901
+ axsL = sfigs [0].subplots(1, 2)
1902
+ axsR = sfigs [0].subplots(2, 1)
1903
1903
1904
- See :doc:`/gallery/subplots_axes_and_figures/subpanels `
1904
+ See :doc:`/gallery/subplots_axes_and_figures/subfigures `
1905
1905
"""
1906
1906
1907
1907
def __init__ (self , subplotspec , parent , * ,
@@ -1913,11 +1913,11 @@ def __init__(self, subplotspec, parent, *,
1913
1913
Parameters
1914
1914
----------
1915
1915
subplotspec : `.gridspec.SubplotSpec`
1916
- defines the region in a parent gridspec where the subpanel will
1916
+ defines the region in a parent gridspec where the subfigure will
1917
1917
be placed
1918
1918
1919
- parent : `.figure.Figure` or `.figure.SubPanel `
1920
- Figure or subpanel that contains the SubPanel . SubPanels
1919
+ parent : `.figure.Figure` or `.figure.SubFigure `
1920
+ Figure or subfigure that contains the SubFigure . SubFigures
1921
1921
can be nested.
1922
1922
1923
1923
facecolor : default: :rc:`figure.facecolor`
@@ -1945,7 +1945,7 @@ def __init__(self, subplotspec, parent, *,
1945
1945
self ._subplotspec = subplotspec
1946
1946
self ._parent = parent
1947
1947
self .figure = parent .figure
1948
- # subpanels use the parent axstack
1948
+ # subfigures use the parent axstack
1949
1949
self ._axstack = parent ._axstack
1950
1950
self .subplotpars = parent .subplotpars
1951
1951
self .dpi_scale_trans = parent .dpi_scale_trans
@@ -2040,7 +2040,7 @@ def init_layoutgrid(self):
2040
2040
2041
2041
def get_axes (self ):
2042
2042
"""
2043
- Return a list of axes in the SubPanel . You can access and modify the
2043
+ Return a list of axes in the SubFigure . You can access and modify the
2044
2044
axes in the Figure through this list.
2045
2045
"""
2046
2046
return self ._localaxes .as_list ()
@@ -2049,8 +2049,8 @@ def get_axes(self):
2049
2049
List of axes in the Figure. You can access and modify the axes
2050
2050
in the Figure through this list.
2051
2051
2052
- Do not modify the list itself. Instead, use "`~.SubPanel .add_axes`,
2053
- `~.SubPanel .add_subplot` or `~.SubPanel .delaxes` to add or remove an
2052
+ Do not modify the list itself. Instead, use "`~.SubFigure .add_axes`,
2053
+ `~.SubFigure .add_subplot` or `~.SubFigure .delaxes` to add or remove an
2054
2054
axes.
2055
2055
""" )
2056
2056
@@ -2074,7 +2074,7 @@ def draw(self, renderer):
2074
2074
self .stale = False
2075
2075
2076
2076
2077
- class Figure (PanelBase ):
2077
+ class Figure (FigureBase ):
2078
2078
"""
2079
2079
The top level container for all the plot elements.
2080
2080
@@ -2215,7 +2215,7 @@ def __init__(self,
2215
2215
self ._cachedRenderer = None
2216
2216
2217
2217
self .set_constrained_layout (constrained_layout )
2218
- # stub for subpanels :
2218
+ # stub for subfigures :
2219
2219
self .panels = []
2220
2220
2221
2221
# groupers to keep track of x and y labels we want to align.
0 commit comments