diff --git a/doc/api/api_changes.rst b/doc/api/api_changes.rst index 171d198f99cd..5f8a945a8da2 100644 --- a/doc/api/api_changes.rst +++ b/doc/api/api_changes.rst @@ -18,7 +18,7 @@ Code changes ------------ * A major refactoring of the axes module was made. The axes module has been -split into smaller modules: + split into smaller modules: - the `_base` module, which contains a new private _AxesBase class. This class contains all methods except plotting and labelling methods. @@ -53,7 +53,7 @@ original location: * As part of the refactoring to enable Qt5 support, the module `matplotlib.backends.qt4_compat` was renamed to `matplotlib.qt_compat`. `qt4_compat` is deprecated in 1.4 and - will be removed in 1.5. + will be removed in 1.5. * The :func:`~matplotlib.pyplot.errorbar` method has been changed such that the upper and lower limits (*lolims*, *uplims*, *xlolims*, *xuplims*) now @@ -76,10 +76,11 @@ original location: point to `IPython.sphinxext.ipython_directive` instead of `matplotlib.sphinxext.ipython_directive`. -* In :module:`~matplotlib.finance`, almost all functions have been deprecated and - replaced with a pair of functions name `*_ochl` and `*_ohlc`. The former is - 'open-close-high-low' order of quotes, and what the module used and the later - is 'open-high-low-close' order of quotes, which is the standard in finance. +* In `~matplotlib.finance`, almost all functions have been deprecated + and replaced with a pair of functions name `*_ochl` and `*_ohlc`. + The former is the 'open-close-high-low' order of quotes used + previously in this module, and the latter is the + 'open-high-low-close' order that is standard in finance. * For consistency the ``face_alpha`` keyword to :class:`matplotlib.patheffects.SimplePatchShadow` has been deprecated in diff --git a/doc/users/whats_new.rst b/doc/users/whats_new.rst index d5f424980dd5..29d09e30949f 100644 --- a/doc/users/whats_new.rst +++ b/doc/users/whats_new.rst @@ -160,7 +160,7 @@ specifically the Skew-T used in meteorology. .. plot:: mpl_examples/api/skewt.py Support for specifying properties of wedge and text in pie charts. -`````````````````````````````````````````````````````````````` +`````````````````````````````````````````````````````````````````` Added the `kwargs` 'wedgeprops' and 'textprops' to :func:`~matplotlib.Axes.pie` to accept properties for wedge and text objects in a pie. For example, one can specify wedgeprops = {'linewidth':3} to specify the width of the borders of @@ -226,7 +226,7 @@ elements of specialized collections ( Fixed the mouse coordinates giving the wrong theta value in Polar graph ``````````````````````````````````````````````````````````````````````` Added code to -:funct:`~matplotlib.InvertedPolarTransform.transform_non_affine` +:func:`~matplotlib.InvertedPolarTransform.transform_non_affine` to ensure that the calculated theta value was between the range of 0 and 2 * pi since the problem was that the value can become negative after applying the direction and rotation to the theta calculation. diff --git a/examples/color/named_colors.py b/examples/color/named_colors.py index 8567c0907864..8b108272aa07 100644 --- a/examples/color/named_colors.py +++ b/examples/color/named_colors.py @@ -41,7 +41,7 @@ ncols = 3 nrows = int(np.ceil(1. * n / ncols)) -fig = plt.figure(figsize=(ncols*5, nrows*4)) +fig = plt.figure(figsize=(ncols*2.5, nrows*2)) for i, (name, color) in enumerate(sorted_colors): ax = fig.add_subplot(nrows, ncols, i + 1) ax.text(0.55, 0.5, name, fontsize=12, diff --git a/examples/images_contours_and_fields/interpolation_none_vs_nearest.py b/examples/images_contours_and_fields/interpolation_none_vs_nearest.py index eaa7d3332574..314ca2a797bb 100644 --- a/examples/images_contours_and_fields/interpolation_none_vs_nearest.py +++ b/examples/images_contours_and_fields/interpolation_none_vs_nearest.py @@ -1,13 +1,13 @@ """ -Displays the difference between interpolation = 'none' and +Displays the difference between interpolation = 'none' and interpolation = 'nearest'. -Interpolation = 'none' and interpolation = 'nearest' are equivalent when -converting a figure to an image file, such as a PNG. -Interpolation = 'none' and interpolation = 'nearest' behave quite -differently, however, when converting a figure to a vector graphics file, -such as a PDF. As shown, Interpolation = 'none' works well when a big -image is scaled down, while interpolation = 'nearest' works well when a +Interpolation = 'none' and interpolation = 'nearest' are equivalent when +converting a figure to an image file, such as a PNG. +Interpolation = 'none' and interpolation = 'nearest' behave quite +differently, however, when converting a figure to a vector graphics file, +such as a PDF. As shown, Interpolation = 'none' works well when a big +image is scaled down, while interpolation = 'nearest' works well when a small image is blown up. """ @@ -41,17 +41,17 @@ fig.text(0.383, 0.90, "Interpolation = 'none'", ha = 'center') fig.text(0.75, 0.90, "Interpolation = 'nearest'", ha = 'center') -#If you were going to run this example on your local machine, you -#would save the figure as a PNG, save the same figure as a PDF, and +#If you were going to run this example on your local machine, you +#would save the figure as a PNG, save the same figure as a PDF, and #then compare them. The following code would suffice. -txt = fig1.text(0.452, 0.95, 'Saved as a PNG', fontsize = 18) +txt = fig.text(0.452, 0.95, 'Saved as a PNG', fontsize = 18) # plt.savefig('None_vs_nearest-png.png') # txt.set_text('Saved as a PDF') # plt.savefig('None_vs_nearest-pdf.pdf') #Here, however, we need to display the PDF on a webpage, which means -#the PDF must be converted into an image. For the purposes of this -#example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into +#the PDF must be converted into an image. For the purposes of this +#example, the 'Nearest_vs_none-pdf.pdf' has been pre-converted into #'Nearest_vs_none-pdf.png' at 80 dpi. We simply need to load and #display it. pdf_im_path = cbook.get_sample_data('None_vs_nearest-pdf.png') diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index e8bd0e74b3fe..d20993e66ddf 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -438,8 +438,8 @@ def legend(self, *args, **kwargs): Notes ----- - Not all kinds of artist are supported by the legend command. - See :ref:`plotting-guide-legend` for details. + Not all kinds of artist are supported by the legend command. + See :ref:`plotting-guide-legend` for details. Examples -------- @@ -3113,105 +3113,129 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True, Parameters ---------- - bxpstats : list of dicts - A list of dictionaries containing stats for each boxplot. - Required keys are: - 'med' - The median (scalar float). - 'q1' - The first quartile (25th percentile) (scalar float). - 'q3' - The first quartile (50th percentile) (scalar float). - 'whislo' - Lower bound of the lower whisker (scalar float). - 'whishi' - Upper bound of the upper whisker (scalar float). - Optional keys are - 'mean' - The mean (scalar float). Needed if showmeans=True. - 'fliers' - Data beyond the whiskers (sequence of floats). - Needed if showfliers=True. - 'cilo' & 'ciho' - Lower and upper confidence intervals about - the median. Needed if shownotches=True. - 'label' - Name of the dataset (string). If available, this - will be used a tick label for the boxplot + bxpstats : list of dicts + A list of dictionaries containing stats for each boxplot. + Required keys are: - positions : array-like, default = [1, 2, ..., n] - Sets the positions of the boxes. The ticks and limits - are automatically set to match the positions. + - ``med``: The median (scalar float). - widths : array-like, default = 0.5 - Either a scalar or a vector and sets the width of each box. The - default is 0.5, or ``0.15*(distance between extreme positions)`` - if that is smaller. + - ``q1``: The first quartile (25th percentile) (scalar + float). - vert : bool, default = False - If True (default), makes the boxes vertical. - If False, makes horizontal boxes. + - ``q3``: The first quartile (50th percentile) (scalar + float). - patch_artist : bool, default = False - If False produces boxes with the Line2D artist - If True produces boxes with the Patch artist + - ``whislo``: Lower bound of the lower whisker (scalar + float). - shownotches : bool, default = False - If False (default), produces a rectangular box plot. - If True, will produce a notched box plot + - ``whishi``: Upper bound of the upper whisker (scalar + float). - showmeans : bool, default = False - If True, will toggle one the rendering of the means + Optional keys are: - showcaps : bool, default = True - If True will toggle one the rendering of the caps + - ``mean``: The mean (scalar float). Needed if + ``showmeans=True``. - showbox : bool, default = True - If True, will toggle one the rendering of box + - ``fliers``: Data beyond the whiskers (sequence of floats). + Needed if ``showfliers=True``. - showfliers : bool, default = True - If True, will toggle one the rendering of the fliers + - ``cilo`` & ``ciho``: Lower and upper confidence intervals + about the median. Needed if ``shownotches=True``. - boxprops : dict or None (default) - If provided, will set the plotting style of the boxes + - ``label``: Name of the dataset (string). If available, + this will be used a tick label for the boxplot - whiskerprops : dict or None (default) - If provided, will set the plotting style of the whiskers + positions : array-like, default = [1, 2, ..., n] + Sets the positions of the boxes. The ticks and limits + are automatically set to match the positions. - capprops : dict or None (default) - If provided, will set the plotting style of the caps + widths : array-like, default = 0.5 + Either a scalar or a vector and sets the width of each + box. The default is 0.5, or ``0.15*(distance between extreme + positions)`` if that is smaller. - flierprops : dict or None (default) - If provided will set the plotting style of the fliers + vert : bool, default = False + If `True` (default), makes the boxes vertical. If `False`, + makes horizontal boxes. - medianprops : dict or None (default) - If provided, will set the plotting style of the medians + patch_artist : bool, default = False + If `False` produces boxes with the + `~matplotlib.lines.Line2D` artist. If `True` produces boxes + with the `~matplotlib.patches.Patch` artist. - meanprops : dict or None (default) - If provided, will set the plotting style of the means + shownotches : bool, default = False + If `False` (default), produces a rectangular box plot. + If `True`, will produce a notched box plot - meanline : bool, default = False - If True (and *showmeans* is True), will try to render the mean - as a line spanning the full width of the box according to - *meanprops*. Not recommended if *shownotches* is also True. - Otherwise, means will be shown as points. + showmeans : bool, default = False + If `True`, will toggle one the rendering of the means + + showcaps : bool, default = True + If `True`, will toggle one the rendering of the caps + + showbox : bool, default = True + If `True`, will toggle one the rendering of box - manage_xticks : bool, default = True - If the function should adjust the xlim and xtick locations. + showfliers : bool, default = True + If `True`, will toggle one the rendering of the fliers + + boxprops : dict or None (default) + If provided, will set the plotting style of the boxes + + whiskerprops : dict or None (default) + If provided, will set the plotting style of the whiskers + + capprops : dict or None (default) + If provided, will set the plotting style of the caps + + flierprops : dict or None (default) + If provided will set the plotting style of the fliers + + medianprops : dict or None (default) + If provided, will set the plotting style of the medians + + meanprops : dict or None (default) + If provided, will set the plotting style of the means + + meanline : bool, default = False + If `True` (and *showmeans* is `True`), will try to render the mean + as a line spanning the full width of the box according to + *meanprops*. Not recommended if *shownotches* is also True. + Otherwise, means will be shown as points. + + manage_xticks : bool, default = True + If the function should adjust the xlim and xtick locations. Returns ------- + result : dict + A dictionary mapping each component of the boxplot to a list + of the :class:`matplotlib.lines.Line2D` instances + created. That dictionary has the following keys (assuming + vertical boxplots): - A dictionary mapping each component of the boxplot - to a list of the :class:`matplotlib.lines.Line2D` - instances created. That dictionary has the following keys - (assuming vertical boxplots): + - ``boxes``: the main body of the boxplot showing the + quartiles and the median's confidence intervals if + enabled. - - boxes: the main body of the boxplot showing the quartiles - and the median's confidence intervals if enabled. - - medians: horizonal lines at the median of each box. - - whiskers: the vertical lines extending to the most extreme, - n-outlier data points. - - caps: the horizontal lines at the ends of the whiskers. - - fliers: points representing data that extend beyone the - whiskers (fliers). - - means: points or lines representing the means. + - ``medians``: horizonal lines at the median of each box. + + - ``whiskers``: the vertical lines extending to the most + extreme, n-outlier data points. + + - ``caps``: the horizontal lines at the ends of the + whiskers. + + - ``fliers``: points representing data that extend beyond + the whiskers (fliers). + + - ``means``: points or lines representing the means. Examples -------- .. plot:: mpl_examples/statistics/bxp_demo.py + """ # lists of artists to be output whiskers = [] @@ -6813,8 +6837,7 @@ def matshow(self, Z, **kwargs): def violinplot(self, dataset, positions=None, vert=True, widths=0.5, showmeans=False, showextrema=True, showmedians=False, points=100, bw_method=None): - """ - Make a violin plot. + """Make a violin plot. Call signature:: @@ -6829,66 +6852,78 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5, Parameters ---------- + dataset : Array or a sequence of vectors. + The input data. - dataset : Array or a sequence of vectors. - The input data. - - positions : array-like, default = [1, 2, ..., n] - Sets the positions of the violins. The ticks and limits are - automatically set to match the positions. + positions : array-like, default = [1, 2, ..., n] + Sets the positions of the violins. The ticks and limits are + automatically set to match the positions. - vert : bool, default = True. - If true, creates a vertical violin plot. - Otherwise, creates a horizontal violin plot. + vert : bool, default = True. + If true, creates a vertical violin plot. + Otherwise, creates a horizontal violin plot. - widths : array-like, default = 0.5 - Either a scalar or a vector that sets the maximal width of - each violin. The default is 0.5, which uses about half of the - available horizontal space. + widths : array-like, default = 0.5 + Either a scalar or a vector that sets the maximal width of + each violin. The default is 0.5, which uses about half of the + available horizontal space. - showmeans : bool, default = False - If true, will toggle rendering of the means. + showmeans : bool, default = False + If `True`, will toggle rendering of the means. - showextrema : bool, default = True - If true, will toggle rendering of the extrema. + showextrema : bool, default = True + If `True`, will toggle rendering of the extrema. - showmedians : bool, default = False - If true, will toggle rendering of the medians. + showmedians : bool, default = False + If `True`, will toggle rendering of the medians. - points : scalar, default = 100 - Defines the number of points to evaluate each of the gaussian - kernel density estimations at. + points : scalar, default = 100 + Defines the number of points to evaluate each of the + gaussian kernel density estimations at. - bw_method : str, scalar or callable, optional - The method used to calculate the estimator bandwidth. This can be - 'scott', 'silverman', a scalar constant or a callable. If a - scalar, this will be used directly as `kde.factor`. If a - callable, it should take a `GaussianKDE` instance as its only - parameter and return a scalar. If None (default), 'scott' is used. + bw_method : str, scalar or callable, optional + The method used to calculate the estimator bandwidth. This can be + 'scott', 'silverman', a scalar constant or a callable. If a + scalar, this will be used directly as `kde.factor`. If a + callable, it should take a `GaussianKDE` instance as its only + parameter and return a scalar. If None (default), 'scott' is used. Returns ------- - A dictionary mapping each component of the violinplot to a list of the - corresponding collection instances created. The dictionary has - the following keys: + result : dict + A dictionary mapping each component of the violinplot to a + list of the corresponding collection instances created. The + dictionary has the following keys: - - bodies: A list of the + - ``bodies``: A list of the :class:`matplotlib.collections.PolyCollection` instances containing the filled area of each violin. - - means: A :class:`matplotlib.collections.LineCollection` instance - created to identify the mean values of each of the violin's - distribution. - - mins: A :class:`matplotlib.collections.LineCollection` instance - created to identify the bottom of each violin's distribution. - - maxes: A :class:`matplotlib.collections.LineCollection` instance - created to identify the top of each violin's distribution. - - bars: A :class:`matplotlib.collections.LineCollection` instance - created to identify the centers of each violin's distribution. - - medians: A :class:`matplotlib.collections.LineCollection` - instance created to identify the median values of each of the + + - ``means``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the mean values of each of the violin's distribution. + - ``mins``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the bottom of each violin's + distribution. + + - ``maxes``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the top of each violin's + distribution. + + - ``bars``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the centers of each violin's + distribution. + + - ``medians``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the median values of each of the + violin's distribution. """ def _kde_method(X, coords): @@ -6902,8 +6937,7 @@ def _kde_method(X, coords): def violin(self, vpstats, positions=None, vert=True, widths=0.5, showmeans=False, showextrema=True, showmedians=False): - """ - Drawing function for violin plots. + """Drawing function for violin plots. Call signature:: @@ -6917,61 +6951,81 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5, Parameters ---------- - vpstats : list of dicts - A list of dictionaries containing stats for each violin plot. - Required keys are: - - coords: A list of scalars containing the coordinates that - the violin's kernel density estimate were evaluated at. - - vals: A list of scalars containing the values of the kernel - density estimate at each of the coordinates given in `coords`. - - mean: The mean value for this violin's dataset. - - median: The median value for this violin's dataset. - - min: The minimum value for this violin's dataset. - - max: The maximum value for this violin's dataset. + vpstats : list of dicts + A list of dictionaries containing stats for each violin plot. + Required keys are: - positions : array-like, default = [1, 2, ..., n] - Sets the positions of the violins. The ticks and limits are - automatically set to match the positions. + - ``coords``: A list of scalars containing the coordinates that + the violin's kernel density estimate were evaluated at. - vert : bool, default = True. - If true, plots the violins veritcally. - Otherwise, plots the violins horizontally. + - ``vals``: A list of scalars containing the values of the + kernel density estimate at each of the coordinates given + in *coords*. - widths : array-like, default = 0.5 - Either a scalar or a vector that sets the maximal width of - each violin. The default is 0.5, which uses about half of the - available horizontal space. + - ``mean``: The mean value for this violin's dataset. - showmeans : bool, default = False - If true, will toggle rendering of the means. + - ``median``: The median value for this violin's dataset. + + - ``min``: The minimum value for this violin's dataset. + + - ``max``: The maximum value for this violin's dataset. + + positions : array-like, default = [1, 2, ..., n] + Sets the positions of the violins. The ticks and limits are + automatically set to match the positions. + + vert : bool, default = True. + If true, plots the violins veritcally. + Otherwise, plots the violins horizontally. - showextrema : bool, default = True - If true, will toggle rendering of the extrema. + widths : array-like, default = 0.5 + Either a scalar or a vector that sets the maximal width of + each violin. The default is 0.5, which uses about half of the + available horizontal space. - showmedians : bool, default = False - If true, will toggle rendering of the medians. + showmeans : bool, default = False + If true, will toggle rendering of the means. + + showextrema : bool, default = True + If true, will toggle rendering of the extrema. + + showmedians : bool, default = False + If true, will toggle rendering of the medians. Returns ------- + result : dict + A dictionary mapping each component of the violinplot to a list of the + corresponding collection instances created. The dictionary has + the following keys: - A dictionary mapping each component of the violinplot to a list of the - corresponding collection instances created. The dictionary has - the following keys: - - - bodies: A list of the + - ``bodies``: A list of the :class:`matplotlib.collections.PolyCollection` instances containing the filled area of each violin. - - means: A :class:`matplotlib.collections.LineCollection` instance - created to identify the mean values of each of the violin's + + - ``means``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the mean values of each of the + violin's distribution. + + - ``mins``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the bottom of each violin's distribution. - - mins: A :class:`matplotlib.collections.LineCollection` instance - created to identify the bottom of each violin's distribution. - - maxes: A :class:`matplotlib.collections.LineCollection` instance - created to identify the top of each violin's distribution. - - bars: A :class:`matplotlib.collections.LineCollection` instance - created to identify the centers of each violin's distribution. - - medians: A :class:`matplotlib.collections.LineCollection` - instance created to identify the median values of each of the + + - ``maxes``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the top of each violin's + distribution. + + - ``bars``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the centers of each violin's + distribution. + + - ``medians``: A + :class:`matplotlib.collections.LineCollection` instance + created to identify the median values of each of the violin's distribution. """ diff --git a/lib/matplotlib/cbook.py b/lib/matplotlib/cbook.py index 402a9e52ea70..d0978fa46d92 100644 --- a/lib/matplotlib/cbook.py +++ b/lib/matplotlib/cbook.py @@ -1882,7 +1882,8 @@ def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None): Returns ------- - bxpstats : A list of dictionaries containing the results for each column + bxpstats : list of dict + A list of dictionaries containing the results for each column of data. Keys of each dictionary are the following: ======== =================================== diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index 857aefc41390..383978cbc44d 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1758,7 +1758,7 @@ def _initialize_x_y(self, z): If a number, all levels will be plotted with this linewidth. If a tuple, different levels will be plotted with different - linewidths in the order specified + linewidths in the order specified. *linestyles*: [ *None* | 'solid' | 'dashed' | 'dashdot' | 'dotted' ] If *linestyles* is *None*, the default is 'solid' unless diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 2b0836887a69..b014950a4930 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -280,18 +280,32 @@ def __init__(self, pad=None, sep=None, width=None, height=None, align=None, mode=None, children=None): """ - *pad* : boundary pad - *sep* : spacing between items - *width*, *height* : width and height of the container box. - calculated if None. - *align* : alignment of boxes. Can be one of 'top', 'bottom', - 'left', 'right', 'center' and 'baseline' - *mode* : packing mode + Parameters + ---------- + pad : float, optional + Boundary pad. - .. note:: - *pad* and *sep* need to given in points and will be - scale with the renderer dpi, while *width* and *height* - need to be in pixels. + sep : float, optional + Spacing between items. + + width : float, optional + + height : float, optional + Width and height of the container box, calculated if + `None`. + + align : str, optional + Alignment of boxes. Can be one of ``top``, ``bottom``, + ``left``, ``right``, ``center`` and ``baseline`` + + mode : str, optional + Packing mode. + + Notes + ----- + *pad* and *sep* need to given in points and will be scale with + the renderer dpi, while *width* and *height* need to be in + pixels. """ super(PackerBase, self).__init__() @@ -314,17 +328,32 @@ def __init__(self, pad=None, sep=None, width=None, height=None, align="baseline", mode="fixed", children=None): """ - *pad* : boundary pad - *sep* : spacing between items - *width*, *height* : width and height of the container box. - calculated if None. - *align* : alignment of boxes - *mode* : packing mode + Parameters + ---------- + pad : float, optional + Boundary pad. - .. note:: - *pad* and *sep* need to given in points and will be - scale with the renderer dpi, while *width* and *height* - need to be in pixels. + sep : float, optional + Spacing between items. + + width : float, optional + + height : float, optional + + width and height of the container box, calculated if + `None`. + + align : str, optional + Alignment of boxes. + + mode : str, optional + Packing mode. + + Notes + ----- + *pad* and *sep* need to given in points and will be scale with + the renderer dpi, while *width* and *height* need to be in + pixels. """ super(VPacker, self).__init__(pad, sep, width, height, align, mode, @@ -378,17 +407,31 @@ def __init__(self, pad=None, sep=None, width=None, height=None, align="baseline", mode="fixed", children=None): """ - *pad* : boundary pad - *sep* : spacing between items - *width*, *height* : width and height of the container box. - calculated if None. - *align* : alignment of boxes - *mode* : packing mode + Parameters + ---------- + pad : float, optional + Boundary pad. - .. note:: - *pad* and *sep* need to given in points and will be - scale with the renderer dpi, while *width* and *height* - need to be in pixels. + sep : float, optional + Spacing between items. + + width : float, optional + + height : float, optional + Width and height of the container box, calculated if + `None`. + + align : str + Alignment of boxes. + + mode : str + Packing mode. + + Notes + ----- + *pad* and *sep* need to given in points and will be scale with + the renderer dpi, while *width* and *height* need to be in + pixels. """ super(HPacker, self).__init__(pad, sep, width, height, align, mode, children) @@ -624,12 +667,20 @@ def __init__(self, s, minimumdescent=True, ): """ - *s* : a string to be displayed. - *textprops* : property dictionary for the text - *multilinebaseline* : If True, baseline for multiline text is - adjusted so that it is (approximatedly) - center-aligned with singleline text. - *minimumdescent* : If True, the box has a minimum descent of "p". + Parameters + ---------- + s : str + a string to be displayed. + + textprops : `~matplotlib.font_manager.FontProperties`, optional + + multilinebaseline : bool, optional + If `True`, baseline for multiline text is adjusted so that + it is (approximatedly) center-aligned with singleline + text. + + minimumdescent : bool, optional + If `True`, the box has a minimum descent of "p". """ if textprops is None: textprops = {} @@ -1093,19 +1144,33 @@ def _get_anchored_bbox(self, loc, bbox, parentbbox, borderpad): class AnchoredText(AnchoredOffsetbox): """ - AnchoredOffsetbox with Text + AnchoredOffsetbox with Text. """ def __init__(self, s, loc, pad=0.4, borderpad=0.5, prop=None, **kwargs): """ - *s* : string - *loc* : location code - *prop* : font property - *pad* : pad between the text and the frame as fraction of the font - size. - *borderpad* : pad between the frame and the axes (or bbox_to_anchor). + Parameters + ---------- + s : string + Text. + + loc : str + Location code. + + pad : float, optional + Pad between the text and the frame as fraction of the font + size. + + borderpad : float, optional + Pad between the frame and the axes (or *bbox_to_anchor*). + + prop : `matplotlib.font_manager.FontProperties` + Font properties. - other keyword parameters of AnchoredOffsetbox are also allowed. + Notes + ----- + Other keyword parameters of `AnchoredOffsetbox` are also + allowed. """ if prop is None: