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

Skip to content

Commit 3d3b8d2

Browse files
NelleVtacaswell
authored andcommitted
Merge pull request #7399 from stilley2/master
Clarify wspace/hspace in documentation/comments
1 parent 6beddec commit 3d3b8d2

File tree

5 files changed

+48
-38
lines changed

5 files changed

+48
-38
lines changed

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
@@ -168,23 +168,25 @@ def __init__(self, left=None, bottom=None, right=None, top=None,
168168
169169
The following attributes are available
170170
171-
*left* : 0.125
171+
left : 0.125
172172
The left side of the subplots of the figure
173173
174-
*right* : 0.9
174+
right : 0.9
175175
The right side of the subplots of the figure
176176
177-
*bottom* : 0.1
177+
bottom : 0.1
178178
The bottom of the subplots of the figure
179179
180-
*top* : 0.9
180+
top : 0.9
181181
The top of the subplots of the figure
182182
183-
*wspace* : 0.2
184-
The amount of width reserved for blank space between subplots
183+
wspace : 0.2
184+
The amount of width reserved for blank space between subplots,
185+
expressed as a fraction of the average axis width
185186
186-
*hspace* : 0.2
187-
The amount of height reserved for white space between subplots
187+
hspace : 0.2
188+
The amount of height reserved for white space between subplots,
189+
expressed as a fraction of the average axis height
188190
"""
189191

190192
self.validate = True
@@ -510,16 +512,16 @@ def suptitle(self, t, **kwargs):
510512
kwargs are :class:`matplotlib.text.Text` properties. Using figure
511513
coordinates, the defaults are:
512514
513-
*x* : 0.5
515+
x : 0.5
514516
The x location of the text in figure coords
515517
516-
*y* : 0.98
518+
y : 0.98
517519
The y location of the text in figure coords
518520
519-
*horizontalalignment* : 'center'
521+
horizontalalignment : 'center'
520522
The horizontal alignment of the text
521523
522-
*verticalalignment* : 'top'
524+
verticalalignment : 'top'
523525
The vertical alignment of the text
524526
525527
If the `fontproperties` keyword argument is given then the
@@ -1189,67 +1191,67 @@ def legend(self, handles, labels, *args, **kwargs):
11891191
11901192
Keyword arguments:
11911193
1192-
*prop*: [ *None* | FontProperties | dict ]
1194+
prop: [ *None* | FontProperties | dict ]
11931195
A :class:`matplotlib.font_manager.FontProperties`
11941196
instance. If *prop* is a dictionary, a new instance will be
11951197
created with *prop*. If *None*, use rc settings.
11961198
1197-
*numpoints*: integer
1199+
numpoints: integer
11981200
The number of points in the legend line, default is 4
11991201
1200-
*scatterpoints*: integer
1202+
scatterpoints: integer
12011203
The number of points in the legend line, default is 4
12021204
1203-
*scatteryoffsets*: list of floats
1205+
scatteryoffsets: list of floats
12041206
a list of yoffsets for scatter symbols in legend
12051207
1206-
*markerscale*: [ *None* | scalar ]
1208+
markerscale: [ *None* | scalar ]
12071209
The relative size of legend markers vs. original. If *None*, use rc
12081210
settings.
12091211
1210-
*markerfirst*: [ *True* | *False* ]
1212+
markerfirst: [ *True* | *False* ]
12111213
if *True*, legend marker is placed to the left of the legend label
12121214
if *False*, legend marker is placed to the right of the legend
12131215
label
12141216
1215-
*frameon*: [ *None* | bool ]
1217+
frameon: [ *None* | bool ]
12161218
Control whether the legend should be drawn on a patch (frame).
12171219
Default is *None* which will take the value from the
12181220
``legend.frameon`` :data:`rcParam<matplotlib.rcParams>`.
12191221
1220-
*fancybox*: [ *None* | *False* | *True* ]
1222+
fancybox: [ *None* | *False* | *True* ]
12211223
if *True*, draw a frame with a round fancybox. If *None*, use rc
12221224
1223-
*shadow*: [ *None* | *False* | *True* ]
1225+
shadow: [ *None* | *False* | *True* ]
12241226
If *True*, draw a shadow behind legend. If *None*, use rc settings.
12251227
1226-
*framealpha*: [ *None* | float ]
1228+
framealpha: [ *None* | float ]
12271229
Control the alpha transparency of the legend's background.
12281230
Default is *None* which will take the value from the
12291231
``legend.framealpha`` :data:`rcParam<matplotlib.rcParams>`.
12301232
1231-
*facecolor*: [ *None* | "inherit" | a color spec ]
1233+
facecolor: [ *None* | "inherit" | a color spec ]
12321234
Control the legend's background color.
12331235
Default is *None* which will take the value from the
12341236
``legend.facecolor`` :data:`rcParam<matplotlib.rcParams>`.
12351237
If ``"inherit"``, it will take the ``axes.facecolor``
12361238
:data:`rcParam<matplotlib.rcParams>`.
12371239
1238-
*edgecolor*: [ *None* | "inherit" | a color spec ]
1240+
edgecolor: [ *None* | "inherit" | a color spec ]
12391241
Control the legend's background patch edge color.
12401242
Default is *None* which will take the value from the
12411243
``legend.edgecolor`` :data:`rcParam<matplotlib.rcParams>`.
12421244
If ``"inherit"``, it will take the ``axes.edgecolor``
12431245
:data:`rcParam<matplotlib.rcParams>`.
12441246
1245-
*ncol* : integer
1247+
ncol : integer
12461248
number of columns. default is 1
12471249
1248-
*mode* : [ "expand" | *None* ]
1250+
mode : [ "expand" | *None* ]
12491251
if mode is "expand", the legend will be horizontally expanded
12501252
to fill the axes area (or *bbox_to_anchor*)
12511253
1252-
*title* : string
1254+
title : string
12531255
the legend title
12541256
12551257
Padding and spacing between various elements use following keywords
@@ -1713,13 +1715,13 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None,
17131715
17141716
Parameters:
17151717
1716-
*pad* : float
1718+
pad : float
17171719
padding between the figure edge and the edges of subplots,
17181720
as a fraction of the font-size.
1719-
*h_pad*, *w_pad* : float
1721+
h_pad, w_pad : float
17201722
padding (height/width) between edges of adjacent subplots.
17211723
Defaults to `pad_inches`.
1722-
*rect* : if rect is given, it is interpreted as a rectangle
1724+
rect : if rect is given, it is interpreted as a rectangle
17231725
(left, bottom, right, top) in the normalized figure
17241726
coordinate that the whole subplots area (including
17251727
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
@@ -321,8 +321,10 @@ figure.subplot.left : 0.125 # the left side of the subplots of the figure
321321
figure.subplot.right : 0.9 # the right side of the subplots of the figure
322322
figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure
323323
figure.subplot.top : 0.9 # the top of the subplots of the figure
324-
figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
325-
figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
324+
figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots,
325+
# expressed as a fraction of the average axis width
326+
figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots,
327+
# expressed as a fraction of the average axis height
326328

327329
### IMAGES
328330
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
@@ -1335,8 +1335,10 @@ def subplots_adjust(*args, **kwargs):
13351335
right = 0.9 # the right side of the subplots of the figure
13361336
bottom = 0.1 # the bottom of the subplots of the figure
13371337
top = 0.9 # the top of the subplots of the figure
1338-
wspace = 0.2 # the amount of width reserved for blank space between subplots
1339-
hspace = 0.2 # the amount of height reserved for white space between subplots
1338+
wspace = 0.2 # the amount of width reserved for blank space between subplots,
1339+
# expressed as a fraction of the average axis width
1340+
hspace = 0.2 # the amount of height reserved for white space between subplots,
1341+
# expressed as a fraction of the average axis height
13401342
13411343
The actual defaults are controlled by the rc file
13421344
"""

matplotlibrc.template

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,8 +453,10 @@ backend : $TEMPLATE_BACKEND
453453
#figure.subplot.right : 0.9 # the right side of the subplots of the figure
454454
#figure.subplot.bottom : 0.11 # the bottom of the subplots of the figure
455455
#figure.subplot.top : 0.88 # the top of the subplots of the figure
456-
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots
457-
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots
456+
#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots,
457+
# expressed as a fraction of the average axis width
458+
#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots,
459+
# expressed as a fraction of the average axis height
458460

459461

460462
### IMAGES

0 commit comments

Comments
 (0)