From 050745972b7ee37782b7db4e6a726685852343e6 Mon Sep 17 00:00:00 2001 From: Steven Tilley Date: Fri, 4 Nov 2016 09:25:04 -0400 Subject: [PATCH 1/2] Clarify wspace/hspace in documentation/comments --- doc/faq/howto_faq.rst | 6 ++++-- lib/matplotlib/figure.py | 6 ++++-- lib/matplotlib/mpl-data/stylelib/classic.mplstyle | 6 ++++-- lib/matplotlib/pyplot.py | 6 ++++-- matplotlibrc.template | 6 ++++-- 5 files changed, 20 insertions(+), 10 deletions(-) diff --git a/doc/faq/howto_faq.rst b/doc/faq/howto_faq.rst index 0e33c11d3f2..18a751344b9 100644 --- a/doc/faq/howto_faq.rst +++ b/doc/faq/howto_faq.rst @@ -176,9 +176,11 @@ The other parameters you can configure are, with their defaults *top* = 0.9 the top of the subplots of the figure *wspace* = 0.2 - the amount of width reserved for blank space between subplots + the amount of width reserved for blank space between subplots, + expressed as a fraction of the average axis width *hspace* = 0.2 - the amount of height reserved for white space between subplots + the amount of height reserved for white space between subplots, + expressed as a fraction of the average axis height If you want additional control, you can create an :class:`~matplotlib.axes.Axes` using the diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 9913d803658..64a35cf9c3b 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -182,10 +182,12 @@ def __init__(self, left=None, bottom=None, right=None, top=None, The top of the subplots of the figure *wspace* : 0.2 - The amount of width reserved for blank space between subplots + The amount of width reserved for blank space between subplots, + expressed as a fraction of the average axis width *hspace* : 0.2 - The amount of height reserved for white space between subplots + The amount of height reserved for white space between subplots, + expressed as a fraction of the average axis height """ self.validate = True diff --git a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle index 071ef5f2065..246bfe4d8d7 100644 --- a/lib/matplotlib/mpl-data/stylelib/classic.mplstyle +++ b/lib/matplotlib/mpl-data/stylelib/classic.mplstyle @@ -316,8 +316,10 @@ figure.subplot.left : 0.125 # the left side of the subplots of the figure figure.subplot.right : 0.9 # the right side of the subplots of the figure figure.subplot.bottom : 0.1 # the bottom of the subplots of the figure figure.subplot.top : 0.9 # the top of the subplots of the figure -figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots -figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots +figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots, + # expressed as a fraction of the average axis width +figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots, + # expressed as a fraction of the average axis height ### IMAGES image.aspect : equal # equal | auto | a number diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 7c0ee0f7ab5..df6defdfb13 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1242,8 +1242,10 @@ def subplots_adjust(*args, **kwargs): right = 0.9 # the right side of the subplots of the figure bottom = 0.1 # the bottom of the subplots of the figure top = 0.9 # the top of the subplots of the figure - wspace = 0.2 # the amount of width reserved for blank space between subplots - hspace = 0.2 # the amount of height reserved for white space between subplots + wspace = 0.2 # the amount of width reserved for blank space between subplots, + # expressed as a fraction of the average axis width + hspace = 0.2 # the amount of height reserved for white space between subplots, + # expressed as a fraction of the average axis height The actual defaults are controlled by the rc file """ diff --git a/matplotlibrc.template b/matplotlibrc.template index b6c3398df05..31e1f7159f7 100644 --- a/matplotlibrc.template +++ b/matplotlibrc.template @@ -449,8 +449,10 @@ backend : $TEMPLATE_BACKEND #figure.subplot.right : 0.9 # the right side of the subplots of the figure #figure.subplot.bottom : 0.11 # the bottom of the subplots of the figure #figure.subplot.top : 0.88 # the top of the subplots of the figure -#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots -#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots +#figure.subplot.wspace : 0.2 # the amount of width reserved for blank space between subplots, + # expressed as a fraction of the average axis width +#figure.subplot.hspace : 0.2 # the amount of height reserved for white space between subplots, + # expressed as a fraction of the average axis height ### IMAGES From 88ee53ce980b8ca38857b2e2405c445fb57edcd8 Mon Sep 17 00:00:00 2001 From: Steven Tilley Date: Fri, 4 Nov 2016 13:04:22 -0400 Subject: [PATCH 2/2] Remove astriks from keword arg doc strings --- lib/matplotlib/figure.py | 56 ++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 64a35cf9c3b..05238486f65 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -169,23 +169,23 @@ def __init__(self, left=None, bottom=None, right=None, top=None, The following attributes are available - *left* : 0.125 + left : 0.125 The left side of the subplots of the figure - *right* : 0.9 + right : 0.9 The right side of the subplots of the figure - *bottom* : 0.1 + bottom : 0.1 The bottom of the subplots of the figure - *top* : 0.9 + top : 0.9 The top of the subplots of the figure - *wspace* : 0.2 + wspace : 0.2 The amount of width reserved for blank space between subplots, expressed as a fraction of the average axis width - *hspace* : 0.2 + hspace : 0.2 The amount of height reserved for white space between subplots, expressed as a fraction of the average axis height """ @@ -513,16 +513,16 @@ def suptitle(self, t, **kwargs): kwargs are :class:`matplotlib.text.Text` properties. Using figure coordinates, the defaults are: - *x* : 0.5 + x : 0.5 The x location of the text in figure coords - *y* : 0.98 + y : 0.98 The y location of the text in figure coords - *horizontalalignment* : 'center' + horizontalalignment : 'center' The horizontal alignment of the text - *verticalalignment* : 'top' + verticalalignment : 'top' The vertical alignment of the text If the `fontproperties` keyword argument is given then the @@ -1316,67 +1316,67 @@ def legend(self, handles, labels, *args, **kwargs): Keyword arguments: - *prop*: [ *None* | FontProperties | dict ] + prop: [ *None* | FontProperties | dict ] A :class:`matplotlib.font_manager.FontProperties` instance. If *prop* is a dictionary, a new instance will be created with *prop*. If *None*, use rc settings. - *numpoints*: integer + numpoints: integer The number of points in the legend line, default is 4 - *scatterpoints*: integer + scatterpoints: integer The number of points in the legend line, default is 4 - *scatteryoffsets*: list of floats + scatteryoffsets: list of floats a list of yoffsets for scatter symbols in legend - *markerscale*: [ *None* | scalar ] + markerscale: [ *None* | scalar ] The relative size of legend markers vs. original. If *None*, use rc settings. - *markerfirst*: [ *True* | *False* ] + markerfirst: [ *True* | *False* ] if *True*, legend marker is placed to the left of the legend label if *False*, legend marker is placed to the right of the legend label - *frameon*: [ *None* | bool ] + frameon: [ *None* | bool ] Control whether the legend should be drawn on a patch (frame). Default is *None* which will take the value from the ``legend.frameon`` :data:`rcParam`. - *fancybox*: [ *None* | *False* | *True* ] + fancybox: [ *None* | *False* | *True* ] if *True*, draw a frame with a round fancybox. If *None*, use rc - *shadow*: [ *None* | *False* | *True* ] + shadow: [ *None* | *False* | *True* ] If *True*, draw a shadow behind legend. If *None*, use rc settings. - *framealpha*: [ *None* | float ] + framealpha: [ *None* | float ] Control the alpha transparency of the legend's background. Default is *None* which will take the value from the ``legend.framealpha`` :data:`rcParam`. - *facecolor*: [ *None* | "inherit" | a color spec ] + facecolor: [ *None* | "inherit" | a color spec ] Control the legend's background color. Default is *None* which will take the value from the ``legend.facecolor`` :data:`rcParam`. If ``"inherit"``, it will take the ``axes.facecolor`` :data:`rcParam`. - *edgecolor*: [ *None* | "inherit" | a color spec ] + edgecolor: [ *None* | "inherit" | a color spec ] Control the legend's background patch edge color. Default is *None* which will take the value from the ``legend.edgecolor`` :data:`rcParam`. If ``"inherit"``, it will take the ``axes.edgecolor`` :data:`rcParam`. - *ncol* : integer + ncol : integer number of columns. default is 1 - *mode* : [ "expand" | *None* ] + mode : [ "expand" | *None* ] if mode is "expand", the legend will be horizontally expanded to fill the axes area (or *bbox_to_anchor*) - *title* : string + title : string the legend title Padding and spacing between various elements use following keywords @@ -1840,13 +1840,13 @@ def tight_layout(self, renderer=None, pad=1.08, h_pad=None, Parameters: - *pad* : float + pad : float padding between the figure edge and the edges of subplots, as a fraction of the font-size. - *h_pad*, *w_pad* : float + h_pad, w_pad : float padding (height/width) between edges of adjacent subplots. Defaults to `pad_inches`. - *rect* : if rect is given, it is interpreted as a rectangle + rect : if rect is given, it is interpreted as a rectangle (left, bottom, right, top) in the normalized figure coordinate that the whole subplots area (including labels) will fit into. Default is (0, 0, 1, 1).