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

Skip to content

Commit bdf2146

Browse files
authored
Merge pull request #7399 from stilley2/master
Clarify wspace/hspace in documentation/comments
2 parents 4019a8c + 88ee53c commit bdf2146

5 files changed

Lines changed: 48 additions & 38 deletions

File tree

doc/faq/howto_faq.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,11 @@ The other parameters you can configure are, with their defaults
176176
*top* = 0.9
177177
the top of the subplots of the figure
178178
*wspace* = 0.2
179-
the amount of width reserved for blank space between subplots
179+
the amount of width reserved for blank space between subplots,
180+
expressed as a fraction of the average axis width
180181
*hspace* = 0.2
181-
the amount of height reserved for white space between subplots
182+
the amount of height reserved for white space between subplots,
183+
expressed as a fraction of the average axis height
182184

183185
If you want additional control, you can create an
184186
:class:`~matplotlib.axes.Axes` using the

lib/matplotlib/figure.py

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -169,23 +169,25 @@ def __init__(self, left=None, bottom=None, right=None, top=None,
169169
170170
The following attributes are available
171171
172-
*left* : 0.125
172+
left : 0.125
173173
The left side of the subplots of the figure
174174
175-
*right* : 0.9
175+
right : 0.9
176176
The right side of the subplots of the figure
177177
178-
*bottom* : 0.1
178+
bottom : 0.1
179179
The bottom of the subplots of the figure
180180
181-
*top* : 0.9
181+
top : 0.9
182182
The top of the subplots of the figure
183183
184-
*wspace* : 0.2
185-
The amount of width reserved for blank space between subplots
184+
wspace : 0.2
185+
The amount of width reserved for blank space between subplots,
186+
expressed as a fraction of the average axis width
186187
187-
*hspace* : 0.2
188-
The amount of height reserved for white space between subplots
188+
hspace : 0.2
189+
The amount of height reserved for white space between subplots,
190+
expressed as a fraction of the average axis height
189191
"""
190192

191193
self.validate = True
@@ -511,16 +513,16 @@ def suptitle(self, t, **kwargs):
511513
kwargs are :class:`matplotlib.text.Text` properties. Using figure
512514
coordinates, the defaults are:
513515
514-
*x* : 0.5
516+
x : 0.5
515517
The x location of the text in figure coords
516518
517-
*y* : 0.98
519+
y : 0.98
518520
The y location of the text in figure coords
519521
520-
*horizontalalignment* : 'center'
522+
horizontalalignment : 'center'
521523
The horizontal alignment of the text
522524
523-
*verticalalignment* : 'top'
525+
verticalalignment : 'top'
524526
The vertical alignment of the text
525527
526528
If the `fontproperties` keyword argument is given then the
@@ -1314,67 +1316,67 @@ def legend(self, handles, labels, *args, **kwargs):
13141316
13151317
Keyword arguments:
13161318
1317-
*prop*: [ *None* | FontProperties | dict ]
1319+
prop: [ *None* | FontProperties | dict ]
13181320
A :class:`matplotlib.font_manager.FontProperties`
13191321
instance. If *prop* is a dictionary, a new instance will be
13201322
created with *prop*. If *None*, use rc settings.
13211323
1322-
*numpoints*: integer
1324+
numpoints: integer
13231325
The number of points in the legend line, default is 4
13241326
1325-
*scatterpoints*: integer
1327+
scatterpoints: integer
13261328
The number of points in the legend line, default is 4
13271329
1328-
*scatteryoffsets*: list of floats
1330+
scatteryoffsets: list of floats
13291331
a list of yoffsets for scatter symbols in legend
13301332
1331-
*markerscale*: [ *None* | scalar ]
1333+
markerscale: [ *None* | scalar ]
13321334
The relative size of legend markers vs. original. If *None*, use rc
13331335
settings.
13341336
1335-
*markerfirst*: [ *True* | *False* ]
1337+
markerfirst: [ *True* | *False* ]
13361338
if *True*, legend marker is placed to the left of the legend label
13371339
if *False*, legend marker is placed to the right of the legend
13381340
label
13391341
1340-
*frameon*: [ *None* | bool ]
1342+
frameon: [ *None* | bool ]
13411343
Control whether the legend should be drawn on a patch (frame).
13421344
Default is *None* which will take the value from the
13431345
``legend.frameon`` :data:`rcParam<matplotlib.rcParams>`.
13441346
1345-
*fancybox*: [ *None* | *False* | *True* ]
1347+
fancybox: [ *None* | *False* | *True* ]
13461348
if *True*, draw a frame with a round fancybox. If *None*, use rc
13471349
1348-
*shadow*: [ *None* | *False* | *True* ]
1350+
shadow: [ *None* | *False* | *True* ]
13491351
If *True*, draw a shadow behind legend. If *None*, use rc settings.
13501352
1351-
*framealpha*: [ *None* | float ]
1353+
framealpha: [ *None* | float ]
13521354
Control the alpha transparency of the legend's background.
13531355
Default is *None* which will take the value from the
13541356
``legend.framealpha`` :data:`rcParam<matplotlib.rcParams>`.
13551357
1356-
*facecolor*: [ *None* | "inherit" | a color spec ]
1358+
facecolor: [ *None* | "inherit" | a color spec ]
13571359
Control the legend's background color.
13581360
Default is *None* which will take the value from the
13591361
``legend.facecolor`` :data:`rcParam<matplotlib.rcParams>`.
13601362
If ``"inherit"``, it will take the ``axes.facecolor``
13611363
:data:`rcParam<matplotlib.rcParams>`.
13621364
1363-
*edgecolor*: [ *None* | "inherit" | a color spec ]
1365+
edgecolor: [ *None* | "inherit" | a color spec ]
13641366
Control the legend's background patch edge color.
13651367
Default is *None* which will take the value from the
13661368
``legend.edgecolor`` :data:`rcParam<matplotlib.rcParams>`.
13671369
If ``"inherit"``, it will take the ``axes.edgecolor``
13681370
:data:`rcParam<matplotlib.rcParams>`.
13691371
1370-
*ncol* : integer
1372+
ncol : integer
13711373
number of columns. default is 1
13721374
1373-
*mode* : [ "expand" | *None* ]
1375+
mode : [ "expand" | *None* ]
13741376
if mode is "expand", the legend will be horizontally expanded
13751377
to fill the axes area (or *bbox_to_anchor*)
13761378
1377-
*title* : string
1379+
title : string
13781380
the legend title
13791381
13801382
Padding and spacing between various elements use following keywords
@@ -1838,13 +1840,13 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None,
18381840
18391841
Parameters:
18401842
1841-
*pad* : float
1843+
pad : float
18421844
padding between the figure edge and the edges of subplots,
18431845
as a fraction of the font-size.
1844-
*h_pad*, *w_pad* : float
1846+
h_pad, w_pad : float
18451847
padding (height/width) between edges of adjacent subplots.
18461848
Defaults to `pad_inches`.
1847-
*rect* : if rect is given, it is interpreted as a rectangle
1849+
rect : if rect is given, it is interpreted as a rectangle
18481850
(left, bottom, right, top) in the normalized figure
18491851
coordinate that the whole subplots area (including
18501852
labels) will fit into. Default is (0, 0, 1, 1).

lib/matplotlib/mpl-data/stylelib/classic.mplstyle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,10 @@ figure.subplot.left : 0.125 # the left side of the subplots of the figure
316316
figure.subplot.right : 0.9 # the right side of the subplots of the figure
317317
figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
318318
figure.subplot.top : 0.9 # the top of the subplots of the figure
319-
figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
320-
figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
319+
figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots,
320+
# expressed as a fraction of the average axis width
321+
figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots,
322+
# expressed as a fraction of the average axis height
321323

322324
### IMAGES
323325
image.aspect : equal # equal | auto | a number

lib/matplotlib/pyplot.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1242,8 +1242,10 @@ def subplots_adjust(*args, **kwargs):
12421242
right = 0.9 # the right side of the subplots of the figure
12431243
bottom = 0.1 # the bottom of the subplots of the figure
12441244
top = 0.9 # the top of the subplots of the figure
1245-
wspace = 0.2 # the amount of width reserved for blank space between subplots
1246-
hspace = 0.2 # the amount of height reserved for white space between subplots
1245+
wspace = 0.2 # the amount of width reserved for blank space between subplots,
1246+
# expressed as a fraction of the average axis width
1247+
hspace = 0.2 # the amount of height reserved for white space between subplots,
1248+
# expressed as a fraction of the average axis height
12471249
12481250
The actual defaults are controlled by the rc file
12491251
"""

matplotlibrc.template

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -449,8 +449,10 @@ backend : $TEMPLATE_BACKEND
449449
#figure.subplot.right : 0.9 # the right side of the subplots of the figure
450450
#figure.subplot.bottom : 0.11 # the bottom of the subplots of the figure
451451
#figure.subplot.top : 0.88 # the top of the subplots of the figure
452-
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
453-
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
452+
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots,
453+
# expressed as a fraction of the average axis width
454+
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots,
455+
# expressed as a fraction of the average axis height
454456

455457

456458
### IMAGES

0 commit comments

Comments
 (0)