diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index b9f4cafc6c7e..5579d19c6ad2 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1296,7 +1296,8 @@ def _label_from_arg(y, default_name): def _add_data_doc(docstring, replace_names): - """Add documentation for a *data* field to the given docstring. + """ + Add documentation for a *data* field to the given docstring. Parameters ---------- @@ -1309,6 +1310,7 @@ def _add_data_doc(docstring, replace_names): Returns ------- + str The augmented docstring. """ if (docstring is None diff --git a/lib/matplotlib/afm.py b/lib/matplotlib/afm.py index 74beae927e6e..dc33f0300766 100644 --- a/lib/matplotlib/afm.py +++ b/lib/matplotlib/afm.py @@ -286,13 +286,13 @@ def _parse_composites(fh): Returns ------- - composites : dict + dict A dict mapping composite character names to a parts list. The parts list is a list of `.CompositePart` entries describing the parts of the composite. - Example - ------- + Examples + -------- A composite definition line:: CC Aacute 2 ; PCC A 0 0 ; PCC acute 160 170 ; diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index 7ff2dd36b5bb..664cf52af249 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -140,7 +140,7 @@ def is_available(self, name): Returns ------- - available : bool + bool """ try: cls = self._registered[name] @@ -1281,7 +1281,7 @@ def to_html5_video(self, embed_limit=None): Returns ------- - video_tag : str + str An HTML5 video tag with the animation embedded as base64 encoded h264 video. If the *embed_limit* is exceeded, this returns the string diff --git a/lib/matplotlib/artist.py b/lib/matplotlib/artist.py index 16dcd623a0bb..0e9cd131e2e7 100644 --- a/lib/matplotlib/artist.py +++ b/lib/matplotlib/artist.py @@ -274,7 +274,7 @@ def get_tightbbox(self, renderer): Returns ------- - bbox : `.Bbox` + `.Bbox` The enclosing bounding box (in figure pixel coordinates). """ bbox = self.get_window_extent(renderer) @@ -305,7 +305,7 @@ def func(artist: Artist) -> Any Returns ------- - oid : int + int The observer id associated with the callback. This id can be used for removing the callback with `.remove_callback` later. @@ -629,7 +629,7 @@ def get_sketch_params(self): Returns ------- - sketch_params : tuple or None + tuple or None A 3-tuple with the following elements: @@ -1109,7 +1109,7 @@ def findobj(self, match=None, include_self=True): Returns ------- - artists : list of `.Artist` + list of `.Artist` """ if match is None: # always return True @@ -1599,7 +1599,7 @@ def kwdoc(artist): Returns ------- - string + str The settable properties of *artist*, as plain text if :rc:`docstring.hardcopy` is False and as a rst table (intended for use in Sphinx) if it is True. diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ba0da395bea1..f6fe59e4c74d 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -104,7 +104,7 @@ def get_title(self, loc="center"): Returns ------- - title : str + str The title text string. """ @@ -145,7 +145,7 @@ def set_title(self, label, fontdict=None, loc=None, pad=None, **kwargs): Returns ------- - text : `.Text` + `.Text` The matplotlib text instance representing the title Other Parameters @@ -209,7 +209,7 @@ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, *, **kwargs : `.Text` properties `.Text` properties control the appearance of the label. - See also + See Also -------- text : Documents the properties supported by `.Text`. """ @@ -262,7 +262,7 @@ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, *, **kwargs : `.Text` properties `.Text` properties control the appearance of the label. - See also + See Also -------- text : Documents the properties supported by `.Text`. """ @@ -377,14 +377,14 @@ def legend(self, *args, **kwargs): is shown in the legend and the automatic mechanism described above is not sufficient. + Returns + ------- + `~matplotlib.legend.Legend` + Other Parameters ---------------- %(_legend_kw_doc)s - Returns - ------- - legend : `~matplotlib.legend.Legend` - Notes ----- Some artists are not supported by this function. See @@ -708,7 +708,7 @@ def text(self, x, y, s, fontdict=None, **kwargs): Returns ------- - text : `.Text` + `.Text` The created `.Text` instance. Other Parameters @@ -784,7 +784,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs): Returns ------- - line : `~matplotlib.lines.Line2D` + `~matplotlib.lines.Line2D` Other Parameters ---------------- @@ -794,7 +794,7 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs): %(_Line2D_docstr)s - See also + See Also -------- hlines : Add horizontal lines in data coordinates. axhspan : Add a horizontal span (rectangle) across the axis. @@ -853,7 +853,7 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs): Returns ------- - line : `~matplotlib.lines.Line2D` + `~matplotlib.lines.Line2D` Other Parameters ---------------- @@ -863,6 +863,12 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs): %(_Line2D_docstr)s + See Also + -------- + vlines : Add vertical lines in data coordinates. + axvspan : Add a vertical span (rectangle) across the axis. + axline : Add a line with an abritrary slope. + Examples -------- * draw a thick red vline at *x* = 0 that spans the yrange:: @@ -877,12 +883,6 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs): the yrange:: >>> axvline(x=.5, ymin=0.25, ymax=0.75) - - See also - -------- - vlines : Add vertical lines in data coordinates. - axvspan : Add a vertical span (rectangle) across the axis. - axline : Add a line with an abritrary slope. """ if "transform" in kwargs: @@ -929,16 +929,16 @@ def axline(self, xy1, xy2, **kwargs): %(_Line2D_docstr)s + See Also + -------- + axhline : for horizontal lines + axvline : for vertical lines + Examples -------- Draw a thick red line passing through (0, 0) and (1, 1):: >>> axline((0, 0), (1, 1), linewidth=4, color='r') - - See Also - -------- - axhline : for horizontal lines - axvline : for vertical lines """ if "transform" in kwargs: @@ -984,7 +984,7 @@ def axhspan(self, ymin, ymax, xmin=0, xmax=1, **kwargs): Returns ------- - rectangle : `~matplotlib.patches.Polygon` + `~matplotlib.patches.Polygon` Horizontal span (rectangle) from (xmin, ymin) to (xmax, ymax). Other Parameters @@ -1036,7 +1036,7 @@ def axvspan(self, xmin, xmax, ymin=0, ymax=1, **kwargs): Returns ------- - rectangle : `~matplotlib.patches.Polygon` + `~matplotlib.patches.Polygon` Vertical span (rectangle) from (xmin, ymin) to (xmax, ymax). Other Parameters @@ -1097,13 +1097,13 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid', Returns ------- - lines : `~matplotlib.collections.LineCollection` + `~matplotlib.collections.LineCollection` Other Parameters ---------------- **kwargs : `~matplotlib.collections.LineCollection` properties. - See also + See Also -------- vlines : vertical lines axhline: horizontal line across the axes @@ -1175,13 +1175,13 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid', Returns ------- - lines : `~matplotlib.collections.LineCollection` + `~matplotlib.collections.LineCollection` Other Parameters ---------------- **kwargs : `~matplotlib.collections.LineCollection` properties. - See also + See Also -------- hlines : horizontal lines axvline: vertical line across the axes @@ -1311,7 +1311,7 @@ def eventplot(self, positions, orientation='horizontal', lineoffsets=1, Returns ------- - list : list of `.EventCollection` + list of `.EventCollection` The `.EventCollection` that were added. Notes @@ -1572,6 +1572,11 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs): You may suppress the warning by adding an empty format string ``plot('n', 'o', '', data=obj)``. + Returns + ------- + list of `.Line2D` + A list of lines representing the plotted data. + Other Parameters ---------------- scalex, scaley : bool, default: True @@ -1593,11 +1598,6 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs): %(_Line2D_docstr)s - Returns - ------- - lines - A list of `.Line2D` objects representing the plotted data. - See Also -------- scatter : XY scatter plot with markers of varying size and/or color ( @@ -2257,7 +2257,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", Returns ------- - container : `.BarContainer` + `.BarContainer` Container with all the bars and optionally errorbars. Other Parameters @@ -2309,7 +2309,7 @@ def bar(self, x, height, width=0.8, bottom=None, *, align="center", *This is for internal use only.* Please use `barh` for horizontal bar plots. Default: 'vertical'. - See also + See Also -------- barh: Plot a horizontal bar plot. @@ -2530,7 +2530,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center", Returns ------- - container : `.BarContainer` + `.BarContainer` Container with all the bars and optionally errorbars. Other Parameters @@ -2578,7 +2578,7 @@ def barh(self, y, width, height=0.8, left=None, *, align="center", log : bool, default: False If ``True``, set the x-axis to be log scale. - See also + See Also -------- bar: Plot a vertical bar plot. @@ -2623,6 +2623,10 @@ def broken_barh(self, xranges, yrange, **kwargs): yrange : (*ymin*, *yheight*) The y-position and extend for all the rectangles. + Returns + ------- + `~.collections.BrokenBarHCollection` + Other Parameters ---------------- **kwargs : `.BrokenBarHCollection` properties @@ -2641,10 +2645,6 @@ def broken_barh(self, xranges, yrange, **kwargs): Supported keywords: %(BrokenBarHCollection)s - - Returns - ------- - collection : `~.collections.BrokenBarHCollection` """ # process the unit information if len(xranges): @@ -2744,7 +2744,7 @@ def stem(self, *args, linefmt=None, markerfmt=None, basefmt=None, bottom=0, Returns ------- - container : `.StemContainer` + `.StemContainer` The container may be treated like a tuple (*markerline*, *stemlines*, *baseline*) @@ -3164,7 +3164,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, Returns ------- - container : `.ErrorbarContainer` + `.ErrorbarContainer` The container contains: - plotline: `.Line2D` instance of x, y plot markers and/or line. @@ -3601,32 +3601,9 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None, zorder : scalar, default: None Sets the zorder of the boxplot. - Other Parameters - ---------------- - showcaps : bool, default: True - Show the caps on the ends of whiskers. - showbox : bool, default: True - Show the central box. - showfliers : bool, default: True - Show the outliers beyond the caps. - showmeans : bool, default: False - Show the arithmetic means. - capprops : dict, default: None - The style of the caps. - boxprops : dict, default: None - The style of the box. - whiskerprops : dict, default: None - The style of the whiskers. - flierprops : dict, default: None - The style of the fliers. - medianprops : dict, default: None - The style of the median. - meanprops : dict, default: None - The style of the mean. - Returns ------- - result : dict + dict A dictionary mapping each component of the boxplot to a list of the `.Line2D` instances created. That dictionary has the following keys (assuming vertical boxplots): @@ -3648,6 +3625,29 @@ def boxplot(self, x, notch=None, sym=None, vert=None, whis=None, - ``means``: points or lines representing the means. + Other Parameters + ---------------- + showcaps : bool, default: True + Show the caps on the ends of whiskers. + showbox : bool, default: True + Show the central box. + showfliers : bool, default: True + Show the outliers beyond the caps. + showmeans : bool, default: False + Show the arithmetic means. + capprops : dict, default: None + The style of the caps. + boxprops : dict, default: None + The style of the box. + whiskerprops : dict, default: None + The style of the whiskers. + flierprops : dict, default: None + The style of the fliers. + medianprops : dict, default: None + The style of the median. + meanprops : dict, default: None + The style of the mean. + """ # Missing arguments default to rcParams. @@ -3879,7 +3879,7 @@ def bxp(self, bxpstats, positions=None, widths=None, vert=True, Returns ------- - result : dict + dict A dictionary mapping each component of the boxplot to a list of the `.Line2D` instances created. That dictionary has the following keys (assuming vertical boxplots): @@ -4364,7 +4364,7 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, Returns ------- - paths : `~matplotlib.collections.PathCollection` + `~matplotlib.collections.PathCollection` Other Parameters ---------------- @@ -4550,6 +4550,20 @@ def hexbin(self, x, y, C=None, gridsize=100, bins=None, Order of scalars is (left, right, bottom, top). + Returns + ------- + `~matplotlib.collections.PolyCollection` + A `.PolyCollection` defining the hexagonal bins. + + - `.PolyCollection.get_offset` contains a Mx2 array containing + the x, y positions of the M hexagon centers. + - `.PolyCollection.get_array` contains the values of the M + hexagons. + + If *marginals* is *True*, horizontal + bar and vertical bar (both PolyCollections) will be attached + to the return collection as attributes *hbar* and *vbar*. + Other Parameters ---------------- cmap : str or `~matplotlib.colors.Colormap`, default: :rc:`image.cmap` @@ -4600,20 +4614,6 @@ def reduce_C_function(C: array) -> float %(PolyCollection)s - Returns - ------- - polycollection : `~matplotlib.collections.PolyCollection` - A `.PolyCollection` defining the hexagonal bins. - - - `.PolyCollection.get_offset` contains a Mx2 array containing - the x, y positions of the M hexagon centers. - - `.PolyCollection.get_array` contains the values of the M - hexagons. - - If *marginals* is *True*, horizontal - bar and vertical bar (both PolyCollections) will be attached - to the return collection as attributes *hbar* and *vbar*. - """ self._process_unit_info(xdata=x, ydata=y, kwargs=kwargs) @@ -4929,7 +4929,7 @@ def arrow(self, x, y, dx, dy, **kwargs): Returns ------- - arrow : `.FancyArrow` + `.FancyArrow` The created `.FancyArrow` object. Notes @@ -5119,6 +5119,11 @@ def _fill_between_x_or_y( value ``y[i]``. - 'mid': Steps occur half-way between the *x* positions. + Returns + ------- + `.PolyCollection` + A `.PolyCollection` containing the plotted polygons. + Other Parameters ---------------- **kwargs @@ -5127,11 +5132,6 @@ def _fill_between_x_or_y( %(PolyCollection)s - Returns - ------- - `.PolyCollection` - A `.PolyCollection` containing the plotted polygons. - See Also -------- fill_between : Fill between two sets of y-values. @@ -5432,7 +5432,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None, Returns ------- - image : `~matplotlib.image.AxesImage` + `~matplotlib.image.AxesImage` Other Parameters ---------------- @@ -5440,7 +5440,7 @@ def imshow(self, X, cmap=None, norm=None, aspect=None, These parameters are passed on to the constructor of the `.AxesImage` artist. - See also + See Also -------- matshow : Plot a matrix or an array as an image. @@ -5698,7 +5698,7 @@ def pcolor(self, *args, shading=None, alpha=None, norm=None, cmap=None, Returns ------- - collection : `matplotlib.collections.Collection` + `matplotlib.collections.Collection` Other Parameters ---------------- @@ -5951,7 +5951,7 @@ def pcolormesh(self, *args, alpha=None, norm=None, cmap=None, vmin=None, Returns ------- - mesh : `matplotlib.collections.QuadMesh` + `matplotlib.collections.QuadMesh` Other Parameters ---------------- @@ -6164,7 +6164,7 @@ def pcolorfast(self, *args, alpha=None, norm=None, cmap=None, vmin=None, Returns ------- - image : `.AxesImage` or `.PcolorImage` or `.QuadMesh` + `.AxesImage` or `.PcolorImage` or `.QuadMesh` The return type depends on the type of grid: - `.AxesImage` for a regular rectangular grid. @@ -6471,7 +6471,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, **kwargs `~matplotlib.patches.Patch` properties - See also + See Also -------- hist2d : 2D histograms @@ -6832,7 +6832,7 @@ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None, `~.Axes.pcolormesh` method and `~matplotlib.collections.QuadMesh` constructor. - See also + See Also -------- hist : 1D histogram plotting @@ -7554,7 +7554,7 @@ def spy(self, Z, precision=0, marker=None, markersize=None, Returns ------- - ret : `~matplotlib.image.AxesImage` or `.Line2D` + `~matplotlib.image.AxesImage` or `.Line2D` The return type depends on the plotting style (see above). Other Parameters @@ -7648,7 +7648,7 @@ def matshow(self, Z, **kwargs): Returns ------- - image : `~matplotlib.image.AxesImage` + `~matplotlib.image.AxesImage` Other Parameters ---------------- @@ -7742,7 +7742,7 @@ def violinplot(self, dataset, positions=None, vert=True, widths=0.5, Returns ------- - result : dict + dict A dictionary mapping each component of the violinplot to a list of the corresponding collection instances created. The dictionary has the following keys: @@ -7842,7 +7842,7 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5, Returns ------- - result : dict + dict A dictionary mapping each component of the violinplot to a list of the corresponding collection instances created. The dictionary has the following keys: diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index 109e2a5b1c03..9e61fdb1a45c 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -415,7 +415,7 @@ def __init__(self, fig, rect, Returns ------- - axes : `~.axes.Axes` + `~.axes.Axes` The new `~.axes.Axes` object. """ @@ -829,7 +829,7 @@ def get_position(self, original=False): Returns ------- - pos : `.Bbox` + `.Bbox` """ if original: @@ -1175,6 +1175,13 @@ def set_prop_cycle(self, *args, **kwargs): Finite-length iterable of the property values. These values are validated and will raise a ValueError if invalid. + See Also + -------- + matplotlib.rcsetup.cycler + Convenience function for creating validated cyclers for properties. + cycler.cycler + The original function for creating unvalidated cyclers. + Examples -------- Setting the property cycle for a single property: @@ -1187,13 +1194,6 @@ def set_prop_cycle(self, *args, **kwargs): >>> ax.set_prop_cycle(color=['red', 'green', 'blue'], ... marker=['o', '+', 'x']) - See Also - -------- - matplotlib.rcsetup.cycler - Convenience function for creating validated cyclers for properties. - cycler.cycler - The original function for creating unvalidated cyclers. - """ if args and kwargs: raise TypeError("Cannot supply both positional and keyword " @@ -1673,7 +1673,7 @@ def axis(self, *args, emit=True, **kwargs): xmin, xmax, ymin, ymax : float The axis limits. - See also + See Also -------- matplotlib.axes.Axes.set_xlim matplotlib.axes.Axes.set_ylim @@ -2759,7 +2759,7 @@ def get_axisbelow(self): Returns ------- - axisbelow : bool or 'line' + bool or 'line' See Also -------- @@ -3388,7 +3388,7 @@ def get_xmajorticklabels(self): Returns ------- - labels : list + list List of `~matplotlib.text.Text` instances """ return self.xaxis.get_majorticklabels() @@ -3399,7 +3399,7 @@ def get_xminorticklabels(self): Returns ------- - labels : list + list List of `~matplotlib.text.Text` instances """ return self.xaxis.get_minorticklabels() @@ -3421,7 +3421,7 @@ def get_xticklabels(self, minor=False, which=None): Returns ------- - ret : list + list List of `~matplotlib.text.Text` instances. Notes @@ -3461,11 +3461,11 @@ def set_xticklabels(self, labels, fontdict=None, minor=False, **kwargs): Returns ------- - labels : list of `~.Text` + list of `~.Text` The labels. Other Parameters - ----------------- + ---------------- **kwargs : `~.text.Text` properties. """ if fontdict is not None: @@ -3781,7 +3781,7 @@ def get_ymajorticklabels(self): Returns ------- - labels : list + list List of `~matplotlib.text.Text` instances """ return self.yaxis.get_majorticklabels() @@ -3792,7 +3792,7 @@ def get_yminorticklabels(self): Returns ------- - labels : list + list List of `~matplotlib.text.Text` instances """ return self.yaxis.get_minorticklabels() @@ -3814,7 +3814,7 @@ def get_yticklabels(self, minor=False, which=None): Returns ------- - ret : list + list List of `~matplotlib.text.Text` instances. Notes @@ -4376,8 +4376,8 @@ def get_tightbbox(self, renderer, call_axes_locator=True, Returns ------- - bbox : `.BboxBase` - bounding box in figure pixel coordinates. + `.BboxBase` + Bounding box in figure pixel coordinates. See Also -------- @@ -4464,7 +4464,7 @@ def twinx(self): Returns ------- - ax_twin : Axes + Axes The newly created Axes instance Notes @@ -4494,7 +4494,7 @@ def twiny(self): Returns ------- - ax_twin : Axes + Axes The newly created Axes instance Notes diff --git a/lib/matplotlib/axes/_secondary_axes.py b/lib/matplotlib/axes/_secondary_axes.py index 1a5f751efe11..2c4d9a15771a 100644 --- a/lib/matplotlib/axes/_secondary_axes.py +++ b/lib/matplotlib/axes/_secondary_axes.py @@ -294,7 +294,7 @@ def set_xlabel(self, xlabel, fontdict=None, labelpad=None, **kwargs): **kwargs : `.Text` properties `.Text` properties control the appearance of the label. - See also + See Also -------- text : Documents the properties supported by `.Text`. """ @@ -319,7 +319,7 @@ def set_ylabel(self, ylabel, fontdict=None, labelpad=None, **kwargs): **kwargs : `.Text` properties `.Text` properties control the appearance of the label. - See also + See Also -------- text : Documents the properties supported by `.Text`. """ @@ -374,14 +374,13 @@ def set_color(self, color): See :doc:`/gallery/subplots_axes_and_figures/secondary_axis` for examples of making these conversions. +Returns +------- +ax : axes._secondary_axes.SecondaryAxis Other Parameters ---------------- **kwargs : `~matplotlib.axes.Axes` properties. Other miscellaneous axes parameters. - -Returns -------- -ax : axes._secondary_axes.SecondaryAxis ''' docstring.interpd.update(_secax_docstring=_secax_docstring) diff --git a/lib/matplotlib/axis.py b/lib/matplotlib/axis.py index ca1b3c5d762a..7eadc8c2cc29 100644 --- a/lib/matplotlib/axis.py +++ b/lib/matplotlib/axis.py @@ -1211,7 +1211,7 @@ def get_ticklabels(self, minor=False, which=None): Returns ------- - ret : list + list List of `~matplotlib.text.Text` instances. """ @@ -1626,7 +1626,7 @@ def set_ticklabels(self, ticklabels, *args, minor=False, **kwargs): Returns ------- - labels : list of `.Text`\s + list of `.Text`\s For each tick, includes ``tick.label1`` if it is visible, then ``tick.label2`` if it is visible, in that order. """ diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 18a750c9f46d..1b6891545f2e 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -986,7 +986,7 @@ def get_sketch_params(self): Returns ------- - sketch_params : tuple or `None` + tuple or `None` A 3-tuple with the following elements: @@ -1850,7 +1850,7 @@ def inaxes(self, xy): Returns ------- - axes : `~matplotlib.axes.Axes` or None + `~matplotlib.axes.Axes` or None The topmost visible axes containing the point, or None if no axes. """ axes_list = [a for a in self.figure.get_axes() diff --git a/lib/matplotlib/backend_managers.py b/lib/matplotlib/backend_managers.py index 1ec8fdf8b0dd..fbaed053a9fe 100644 --- a/lib/matplotlib/backend_managers.py +++ b/lib/matplotlib/backend_managers.py @@ -424,7 +424,7 @@ def get_tool(self, name, warn=True): Returns ------- - tool : `.ToolBase` or None + `.ToolBase` or None The tool or None if no tool with the given name exists. """ if isinstance(name, tools.ToolBase) and name.name in self._tools: diff --git a/lib/matplotlib/category.py b/lib/matplotlib/category.py index a897dc4e85fc..b8e7ea233ac9 100644 --- a/lib/matplotlib/category.py +++ b/lib/matplotlib/category.py @@ -43,7 +43,7 @@ def convert(value, unit, axis): Returns ------- - mapped_value : float or ndarray[float] + float or ndarray[float] """ if unit is None: raise ValueError( @@ -75,7 +75,7 @@ def axisinfo(unit, axis): Returns ------- - axisinfo : `~matplotlib.units.AxisInfo` + `~matplotlib.units.AxisInfo` Information to support default tick labeling .. note: axis is not used @@ -99,7 +99,7 @@ def default_units(data, axis): Returns ------- - class : `.UnitData` + `.UnitData` object storing string to integer mapping """ # the conversion call stack is default_units -> axis_info -> convert diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index c51681835645..59139c30f4b1 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -101,7 +101,8 @@ def __hash__(self): class CallbackRegistry: - """Handle registering and disconnecting for a set of signals and callbacks: + """ + Handle registering and disconnecting for a set of signals and callbacks: >>> def oneat(x): ... print('eat', x) @@ -303,7 +304,7 @@ def local_over_kwdict(local_var, kwargs, *keys): Returns ------- - out : any object + any object Either local_var or one of kwargs[key] for key in keys. Raises @@ -1137,7 +1138,7 @@ def boxplot_stats(X, whis=1.5, bootstrap=None, labels=None, Returns ------- - bxpstats : list of dict + list of dict A list of dictionaries containing the results for each column of data. Keys of each dictionary are the following: @@ -1461,7 +1462,7 @@ def violin_stats(X, method, points=100, quantiles=None): Returns ------- - vpstats : list of dict + list of dict A list of dictionaries containing the results for each column of data. The dictionaries contain at least the following: @@ -1540,7 +1541,7 @@ def pts_to_prestep(x, *args): Returns ------- - out : array + array The x and y values converted to steps in the same order as the input; can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is length ``N``, each of these arrays will be length ``2N + 1``. For @@ -1578,7 +1579,7 @@ def pts_to_poststep(x, *args): Returns ------- - out : array + array The x and y values converted to steps in the same order as the input; can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is length ``N``, each of these arrays will be length ``2N + 1``. For @@ -1615,7 +1616,7 @@ def pts_to_midstep(x, *args): Returns ------- - out : array + array The x and y values converted to steps in the same order as the input; can be unpacked as ``x_out, y1_out, ..., yp_out``. If the input is length ``N``, each of these arrays will be length ``2N``. @@ -1869,7 +1870,8 @@ def _lock_path(path): def _topmost_artist( artists, _cached_max=functools.partial(max, key=operator.attrgetter("zorder"))): - """Get the topmost artist of a list. + """ + Get the topmost artist of a list. In case of a tie, return the *last* of the tied artists, as it will be drawn on top of the others. `max` returns the first maximum in case of @@ -1879,7 +1881,8 @@ def _topmost_artist( def _str_equal(obj, s): - """Return whether *obj* is a string equal to string *s*. + """ + Return whether *obj* is a string equal to string *s*. This helper solely exists to handle the case where *obj* is a numpy array, because in such cases, a naive ``obj == s`` would yield an array, which @@ -1889,7 +1892,8 @@ def _str_equal(obj, s): def _str_lower_equal(obj, s): - """Return whether *obj* is a string equal, when lowercased, to string *s*. + """ + Return whether *obj* is a string equal, when lowercased, to string *s*. This helper solely exists to handle the case where *obj* is a numpy array, because in such cases, a naive ``obj == s`` would yield an array, which @@ -1899,7 +1903,8 @@ def _str_lower_equal(obj, s): def _define_aliases(alias_d, cls=None): - """Class decorator for defining property aliases. + """ + Class decorator for defining property aliases. Use as :: @@ -1954,16 +1959,16 @@ def get_aliased_and_aliases(d): def _array_perimeter(arr): """ - Get the elements on the perimeter of ``arr``, + Get the elements on the perimeter of *arr*. Parameters ---------- arr : ndarray, shape (M, N) - The input array + The input array. Returns ------- - perimeter : ndarray, shape (2*(M - 1) + 2*(N - 1),) + ndarray, shape (2*(M - 1) + 2*(N - 1),) The elements on the perimeter of the array:: [arr[0, 0], ..., arr[0, -1], ..., arr[-1, -1], ..., arr[-1, 0], ...] @@ -2010,7 +2015,7 @@ def _unfold(arr, axis, size, step): Returns ------- - windows : ndarray, shape (N_1, ..., 1 + (N_axis-size)/step, ..., N_k, size) + ndarray, shape (N_1, ..., 1 + (N_axis-size)/step, ..., N_k, size) Examples -------- @@ -2062,7 +2067,7 @@ def _array_patch_perimeters(x, rstride, cstride): Returns ------- - patches : ndarray, shape (N/rstride * M/cstride, 2 * (rstride + cstride)) + ndarray, shape (N/rstride * M/cstride, 2 * (rstride + cstride)) """ assert rstride > 0 and cstride > 0 assert (x.shape[0] - 1) % rstride == 0 @@ -2094,7 +2099,8 @@ def _array_patch_perimeters(x, rstride, cstride): @contextlib.contextmanager def _setattr_cm(obj, **kwargs): - """Temporarily set some attributes; restore original state at context exit. + """ + Temporarily set some attributes; restore original state at context exit. """ sentinel = object() origs = [(attr, getattr(obj, attr, sentinel)) for attr in kwargs] diff --git a/lib/matplotlib/cm.py b/lib/matplotlib/cm.py index 415f3c110797..fc5dacbf7cb8 100644 --- a/lib/matplotlib/cm.py +++ b/lib/matplotlib/cm.py @@ -322,7 +322,7 @@ def get_alpha(self): """ Returns ------- - alpha : float + float Always returns 1. """ # This method is intended to be overridden by Artist sub-classes diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index 42a31bc1b10a..31673a771212 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -855,7 +855,7 @@ def get_sizes(self): Returns ------- - sizes : array + array The 'area' of each element. """ return self._sizes @@ -1398,7 +1398,7 @@ def get_segments(self): """ Returns ------- - segments : list + list List of segments in the LineCollection. Each list item contains an array of vertices. """ diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index e2cc6cbd2151..df8269e2784f 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -1703,7 +1703,7 @@ def colorbar_factory(cax, mappable, **kwargs): Returns ------- - colorbar : `.Colorbar` or `.ColorbarPatch` + `.Colorbar` or `.ColorbarPatch` The created colorbar instance. `.ColorbarPatch` is only used if *mappable* is a `.ContourSet` with hatches. """ diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index 3ce45882b34c..817ad25c8af5 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -427,7 +427,7 @@ def _create_lookup_table(N, data, gamma=1.0): Returns ------- - lut : array + array The lookup table where ``lut[x * (N-1)]`` gives the closest value for values of x between 0 and 1. @@ -1478,7 +1478,7 @@ def rgb_to_hsv(arr): Returns ------- - hsv : (..., 3) ndarray + (..., 3) ndarray Colors converted to hsv values in range [0, 1] """ arr = np.asarray(arr) @@ -1529,7 +1529,7 @@ def hsv_to_rgb(hsv): Returns ------- - rgb : (..., 3) ndarray + (..., 3) ndarray Colors converted to RGB values in range [0, 1] """ hsv = np.asarray(hsv) @@ -1697,7 +1697,7 @@ def hillshade(self, elevation, vert_exag=1, dx=1, dy=1, fraction=1.): Returns ------- - intensity : ndarray + ndarray A 2d array of illumination values between 0-1, where 0 is completely in shadow and 1 is completely illuminated. """ @@ -1740,7 +1740,7 @@ def shade_normals(self, normals, fraction=1.): Returns ------- - intensity : ndarray + ndarray A 2d array of illumination values between 0-1, where 0 is completely in shadow and 1 is completely illuminated. """ @@ -1823,7 +1823,7 @@ def shade(self, data, cmap, norm=None, blend_mode='overlay', vmin=None, Returns ------- - rgba : ndarray + ndarray An MxNx4 array of floats ranging between 0-1. """ if vmin is None: @@ -1884,7 +1884,7 @@ def shade_rgb(self, rgb, elevation, fraction=1., blend_mode='hsv', Returns ------- - shaded_rgb : ndarray + ndarray An (m, n, 3) array of floats ranging between 0-1. """ # Calculate the "hillshade" intensity. @@ -1950,7 +1950,7 @@ def blend_hsv(self, rgb, intensity, hsv_max_sat=None, hsv_max_val=None, Returns ------- - rgb : ndarray + ndarray An MxNx3 RGB array representing the combined images. """ # Backward compatibility... @@ -2000,7 +2000,7 @@ def blend_soft_light(self, rgb, intensity): Returns ------- - rgb : ndarray + ndarray An MxNx3 RGB array representing the combined images. """ return 2 * intensity * rgb + (1 - 2 * intensity) * rgb**2 @@ -2018,7 +2018,7 @@ def blend_overlay(self, rgb, intensity): Returns ------- - rgb : ndarray + ndarray An MxNx3 RGB array representing the combined images. """ low = 2 * intensity * rgb diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index 59e984db2d0d..3f081e366c0c 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1622,7 +1622,7 @@ def _initialize_x_y(self, z): Returns ------- - c : `~.contour.QuadContourSet` + `~.contour.QuadContourSet` Other Parameters ---------------- diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 42203f1982d0..d6c8316effdf 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -477,7 +477,7 @@ def drange(dstart, dend, delta): Returns ------- - drange : `numpy.array` + `numpy.array` A list floats representing Matplotlib dates. """ diff --git a/lib/matplotlib/dviread.py b/lib/matplotlib/dviread.py index ecdeb32ed837..ba973c23a77e 100644 --- a/lib/matplotlib/dviread.py +++ b/lib/matplotlib/dviread.py @@ -985,7 +985,7 @@ def _parse_enc(path): Returns ------- - encoding : list + list The nth entry of the list is the PostScript glyph name of the nth glyph. """ diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 313f5d2be4c6..93edcb57c625 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -890,7 +890,7 @@ def get_size_inches(self): Returns ------- - size : ndarray + ndarray The size (width, height) of the figure in inches. See Also @@ -1032,7 +1032,8 @@ def add_artist(self, artist, clip=False): Returns ------- - artist : The added `~matplotlib.artist.Artist` + `~matplotlib.artist.Artist` + The added artist. """ artist.set_figure(self) self.artists.append(artist) @@ -1142,6 +1143,14 @@ def add_axes(self, *args, **kwargs): label : str A label for the returned axes. + Returns + ------- + `~.axes.Axes` (or a subclass of `~.axes.Axes`) + The returned axes class depends on the projection used. It is + `~.axes.Axes` if rectilinear projection are used and + `.projections.polar.PolarAxes` if polar projection + are used. + Other Parameters ---------------- **kwargs @@ -1154,14 +1163,6 @@ def add_axes(self, *args, **kwargs): %(Axes)s - Returns - ------- - axes : `~.axes.Axes` (or a subclass of `~.axes.Axes`) - The returned axes class depends on the projection used. It is - `~.axes.Axes` if rectilinear projection are used and - `.projections.polar.PolarAxes` if polar projection - are used. - Notes ----- If the figure already has an axes with key (*args*, @@ -1290,6 +1291,16 @@ def add_subplot(self, *args, **kwargs): label : str A label for the returned axes. + Returns + ------- + `.axes.SubplotBase`, or another subclass of `~.axes.Axes` + + The axes of the subplot. The returned axes base class depends on + the projection used. It is `~.axes.Axes` if rectilinear projection + are used and `.projections.polar.PolarAxes` if polar projection + are used. The returned axes is then a subplot subclass of the + base class. + Other Parameters ---------------- **kwargs @@ -1301,16 +1312,6 @@ def add_subplot(self, *args, **kwargs): %(Axes)s - Returns - ------- - axes : `.axes.SubplotBase`, or another subclass of `~.axes.Axes` - - The axes of the subplot. The returned axes base class depends on - the projection used. It is `~.axes.Axes` if rectilinear projection - are used and `.projections.polar.PolarAxes` if polar projection - are used. The returned axes is then a subplot subclass of the - base class. - Notes ----- If the figure already has a subplot with key (*args*, @@ -1473,11 +1474,17 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False, Returns ------- - ax : `~.axes.Axes` or array of Axes - *ax* can be either a single `~matplotlib.axes.Axes` object or - an array of Axes objects if more than one subplot was created. The - dimensions of the resulting array can be controlled with the - squeeze keyword, see above. + `~.axes.Axes` or array of Axes + Either a single `~matplotlib.axes.Axes` object or an array of Axes + objects if more than one subplot was created. The dimensions of the + resulting array can be controlled with the *squeeze* keyword, see + above. + + See Also + -------- + .pyplot.subplots + .Figure.add_subplot + .pyplot.subplot Examples -------- @@ -1517,12 +1524,6 @@ def subplots(self, nrows=1, ncols=1, sharex=False, sharey=False, # Note that this is the same as fig.subplots(2, 2, sharex=True, sharey=True) - - See Also - -------- - .pyplot.subplots - .Figure.add_subplot - .pyplot.subplot """ if isinstance(sharex, bool): @@ -1788,14 +1789,14 @@ def legend(self, *args, **kwargs): is shown in the legend and the automatic mechanism described above is not sufficient. - Other Parameters - ---------------- - %(_legend_kw_doc)s - Returns ------- `~matplotlib.legend.Legend` + Other Parameters + ---------------- + %(_legend_kw_doc)s + Notes ----- Some artists are not supported by this function. See @@ -1843,6 +1844,10 @@ def text(self, x, y, s, fontdict=None, **kwargs): the defaults are determined by :rc:`font.*`. Properties passed as *kwargs* override the corresponding ones given in *fontdict*. + Returns + ------- + `~.text.Text` + Other Parameters ---------------- **kwargs : `~matplotlib.text.Text` properties @@ -1850,10 +1855,6 @@ def text(self, x, y, s, fontdict=None, **kwargs): %(Text)s - Returns - ------- - text : `~.text.Text` - See Also -------- .Axes.text @@ -2286,7 +2287,7 @@ def ginput(self, n=1, timeout=30, show_clicks=True, Returns ------- - points : list of tuples + list of tuples A list of the clicked (x, y) coordinates. Notes @@ -2343,7 +2344,7 @@ def get_tightbbox(self, renderer, bbox_extra_artists=None): Returns ------- - bbox : `.BboxBase` + `.BboxBase` containing the bounding box (in figure inches). """ @@ -2641,7 +2642,7 @@ def add_gridspec(self, nrows, ncols, **kwargs): Returns ------- - gridspec : `.GridSpec` + `.GridSpec` Other Parameters ---------------- diff --git a/lib/matplotlib/font_manager.py b/lib/matplotlib/font_manager.py index 66e6b4597bae..0b36677e4daa 100644 --- a/lib/matplotlib/font_manager.py +++ b/lib/matplotlib/font_manager.py @@ -255,8 +255,7 @@ def win32InstalledFonts(directory=None, fontext='ttf'): @lru_cache() def _call_fc_list(): - """Cache and list the font filenames known to `fc-list`. - """ + """Cache and list the font filenames known to `fc-list`.""" # Delay the warning by 5s. timer = Timer(5, lambda: _log.warning( 'Matplotlib is building the font cache using fc-list. ' @@ -908,15 +907,15 @@ def json_dump(data, filename): """ Dump `FontManager` *data* as JSON to the file named *filename*. + See Also + -------- + json_load + Notes ----- File paths that are children of the Matplotlib data path (typically, fonts shipped with Matplotlib) are stored relative to that data path (to remain valid across virtualenvs). - - See Also - -------- - json_load """ with open(filename, 'w') as fh: try: @@ -1197,7 +1196,7 @@ def findfont(self, prop, fontext='ttf', directory=None, Returns ------- - fontfile : str + str The filename of the best matching font. Notes diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py index 8ba8f15c0e03..dcfd576f18a0 100644 --- a/lib/matplotlib/gridspec.py +++ b/lib/matplotlib/gridspec.py @@ -692,7 +692,7 @@ def subgridspec(self, nrows, ncols, **kwargs): Returns ------- - gridspec : `.GridSpecFromSubplotSpec` + `.GridSpecFromSubplotSpec` Other Parameters ---------------- diff --git a/lib/matplotlib/image.py b/lib/matplotlib/image.py index 913dbd21fbf8..e6e08354a439 100644 --- a/lib/matplotlib/image.py +++ b/lib/matplotlib/image.py @@ -1421,7 +1421,7 @@ def imread(fname, format=None): Returns ------- - imagedata : :class:`numpy.array` + `numpy.array` The image data. The returned array has shape - (M, N) for grayscale images. @@ -1656,7 +1656,7 @@ def thumbnail(infile, thumbfile, scale=0.1, interpolation='bilinear', Returns ------- - figure : `~.figure.Figure` + `~.figure.Figure` The figure instance containing the thumbnail. """ diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py index fb47147d152f..3e7ee14e25af 100644 --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -888,7 +888,8 @@ def get_tightbbox(self, renderer): Returns ------- - `.BboxBase` : containing the bounding box in figure pixel coordinates. + `.BboxBase` + The bounding box in figure pixel coordinates. """ return self._legend_box.get_window_extent(renderer) diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index d205b119a3f1..9bde8df9a4cc 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -3440,7 +3440,7 @@ def to_png(self, filename, texstr, color='black', dpi=120, fontsize=14): Returns ------- - depth : int + int Offset of the baseline from the bottom of the image, in pixels. """ rgba, depth = self.to_rgba( @@ -3459,7 +3459,7 @@ def get_depth(self, texstr, dpi=120, fontsize=14): Returns ------- - depth : int + int Offset of the baseline from the bottom of the image, in pixels. """ assert self._output == "bitmap" diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index d14fe7024a2e..3852a0a36a9d 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -1076,7 +1076,7 @@ def evaluate(self, points): Returns ------- - values : (# of points,)-array + (# of points,)-array The values at each point. Raises diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index f504a9a4c64b..48ae3276cbaf 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -1009,7 +1009,7 @@ def get_path(self): Returns ------- - path : Path + Path The `~.path.Path` object for the polygon. """ return self._path @@ -1020,7 +1020,7 @@ def get_closed(self): Returns ------- - closed : bool + bool If the path is closed """ return self._closed @@ -1046,7 +1046,7 @@ def get_xy(self): Returns ------- - vertices : (N, 2) numpy array + (N, 2) numpy array The coordinates of the vertices. """ return self._path.vertices @@ -1949,7 +1949,7 @@ def __call__(self, x0, y0, width, height, mutation_size, Returns ------- - path : `~matplotlib.path.Path` + `~matplotlib.path.Path` """ # The __call__ method is a thin wrapper around the transmute method # and takes care of the aspect. @@ -3968,7 +3968,7 @@ def get_dpi_cor(self): Returns ------- - dpi_cor : scalar + scalar """ return self._dpi_cor @@ -4094,7 +4094,7 @@ def get_mutation_scale(self): Returns ------- - scale : scalar + scalar """ return self._mutation_scale diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 7db416408e11..44392cc81af2 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -962,7 +962,7 @@ def get_path_collection_extents( master_transform : `~.Transform` Global transformation applied to all paths. paths : list of `Path` - transform : list of `~.Affine2D` + transforms : list of `~.Affine2D` offsets : (N, 2) array-like offset_transform : `~.Affine2D` Transform applied to the offsets before offsetting the path. diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index cf8b63c2a2ff..007308fb4933 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1298,8 +1298,11 @@ def set_thetagrids(self, angles, labels=None, fmt=None, **kwargs): Returns ------- - lines, labels : list of `.lines.Line2D`, list of `.text.Text` - *lines* are the theta gridlines and *labels* are the tick labels. + lines : list of `.lines.Line2D` + The theta gridlines. + + labels : list of `.text.Text` + The tick labels. Other Parameters ---------------- @@ -1348,8 +1351,11 @@ def set_rgrids(self, radii, labels=None, angle=None, fmt=None, Returns ------- - lines, labels : list of `.lines.Line2D`, list of `.text.Text` - *lines* are the radial gridlines and *labels* are the tick labels. + lines : list of `.lines.Line2D` + The radial gridlines. + + labels : list of `.text.Text` + The tick labels. Other Parameters ---------------- diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index bce356516fdd..89b1c64971ee 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -490,7 +490,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N Returns ------- - figure : `~matplotlib.figure.Figure` + `~matplotlib.figure.Figure` The `.Figure` instance returned will also be passed to new_figure_manager in the backends, which allows to hook custom `.Figure` classes into the pyplot interface. Additional kwargs will be @@ -654,7 +654,7 @@ def get_current_fig_manager(): Returns ------- - manager : `.FigureManagerBase` or backend-dependent subclass thereof + `.FigureManagerBase` or backend-dependent subclass thereof """ return gcf().canvas.manager @@ -789,6 +789,14 @@ def axes(arg=None, **kwargs): label : str A label for the returned axes. + Returns + ------- + `~.axes.Axes` (or a subclass of `~.axes.Axes`) + The returned axes class depends on the projection used. It is + `~.axes.Axes` if rectilinear projection are used and + `.projections.polar.PolarAxes` if polar projection + are used. + Other Parameters ---------------- **kwargs @@ -801,14 +809,6 @@ def axes(arg=None, **kwargs): %(Axes)s - Returns - ------- - axes : `~.axes.Axes` (or a subclass of `~.axes.Axes`) - The returned axes class depends on the projection used. It is - `~.axes.Axes` if rectilinear projection are used and - `.projections.polar.PolarAxes` if polar projection - are used. - Notes ----- If the figure already has a axes with key (*args*, @@ -914,6 +914,17 @@ def subplot(*args, **kwargs): label : str A label for the returned axes. + Returns + ------- + an `.axes.SubplotBase` subclass of `~.axes.Axes` (or a subclass of \ +`~.axes.Axes`) + + The axes of the subplot. The returned axes base class depends on + the projection used. It is `~.axes.Axes` if rectilinear projection + are used and `.projections.polar.PolarAxes` if polar projection + are used. The returned axes is then a subplot subclass of the + base class. + Other Parameters ---------------- **kwargs @@ -925,17 +936,6 @@ def subplot(*args, **kwargs): %(Axes)s - Returns - ------- - axes : an `.axes.SubplotBase` subclass of `~.axes.Axes` (or a subclass \ - of `~.axes.Axes`) - - The axes of the subplot. The returned axes base class depends on - the projection used. It is `~.axes.Axes` if rectilinear projection - are used and `.projections.polar.PolarAxes` if polar projection - are used. The returned axes is then a subplot subclass of the - base class. - Notes ----- Creating a subplot will delete any pre-existing subplot that overlaps @@ -1112,6 +1112,14 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, because for the latter it's not clear if it refers to a single `~.axes.Axes` instance or a collection of these. + See Also + -------- + .pyplot.figure + .pyplot.subplot + .pyplot.axes + .Figure.subplots + .Figure.add_subplot + Examples -------- :: @@ -1152,14 +1160,6 @@ def subplots(nrows=1, ncols=1, sharex=False, sharey=False, squeeze=True, # and clears it if it already exists. fig, ax = plt.subplots(num=10, clear=True) - See Also - -------- - .pyplot.figure - .pyplot.subplot - .pyplot.axes - .Figure.subplots - .Figure.add_subplot - """ fig = figure(**fig_kw) axs = fig.subplots(nrows=nrows, ncols=ncols, sharex=sharex, sharey=sharey, @@ -1562,14 +1562,24 @@ def rgrids(*args, **kwargs): Returns ------- - lines, labels : list of `.lines.Line2D`, list of `.text.Text` - *lines* are the radial gridlines and *labels* are the tick labels. + lines : list of `.lines.Line2D` + The radial gridlines. + + labels : list of `.text.Text` + The tick labels. Other Parameters ---------------- **kwargs *kwargs* are optional `~.Text` properties for the labels. + See Also + -------- + .pyplot.thetagrids + .projections.polar.PolarAxes.set_rgrids + .Axis.get_gridlines + .Axis.get_ticklabels + Examples -------- :: @@ -1579,13 +1589,6 @@ def rgrids(*args, **kwargs): # set the locations and labels of the radial gridlines lines, labels = rgrids( (0.25, 0.5, 1.0), ('Tom', 'Dick', 'Harry' )) - - See Also - -------- - .pyplot.thetagrids - .projections.polar.PolarAxes.set_rgrids - .Axis.get_gridlines - .Axis.get_ticklabels """ ax = gca() if not isinstance(ax, PolarAxes): @@ -1626,14 +1629,24 @@ def thetagrids(*args, **kwargs): Returns ------- - lines, labels : list of `.lines.Line2D`, list of `.text.Text` - *lines* are the theta gridlines and *labels* are the tick labels. + lines : list of `.lines.Line2D` + The theta gridlines. + + labels : list of `.text.Text` + The tick labels. Other Parameters ---------------- **kwargs *kwargs* are optional `~.Text` properties for the labels. + See Also + -------- + .pyplot.rgrids + .projections.polar.PolarAxes.set_thetagrids + .Axis.get_gridlines + .Axis.get_ticklabels + Examples -------- :: @@ -1643,13 +1656,6 @@ def thetagrids(*args, **kwargs): # set the locations and labels of the angular gridlines lines, labels = thetagrids(range(45, 360, 90), ('NE', 'NW', 'SW', 'SE')) - - See Also - -------- - .pyplot.rgrids - .projections.polar.PolarAxes.set_thetagrids - .Axis.get_gridlines - .Axis.get_ticklabels """ ax = gca() if not isinstance(ax, PolarAxes): @@ -2080,7 +2086,7 @@ def matshow(A, fignum=None, **kwargs): Returns ------- - image : `~matplotlib.image.AxesImage` + `~matplotlib.image.AxesImage` Other Parameters ---------------- diff --git a/lib/matplotlib/rcsetup.py b/lib/matplotlib/rcsetup.py index f8459413bbeb..664cbfeaba9d 100644 --- a/lib/matplotlib/rcsetup.py +++ b/lib/matplotlib/rcsetup.py @@ -618,7 +618,7 @@ def validate_markevery(s): Returns ------- - s : None, int, float, slice, length-2 tuple of ints, + None, int, float, slice, length-2 tuple of ints, length-2 tuple of floats, list of ints """ @@ -847,7 +847,7 @@ def cycler(*args, **kwargs): Returns ------- - cycler : Cycler + Cycler A new :class:`~cycler.Cycler` for the given properties. Examples diff --git a/lib/matplotlib/stackplot.py b/lib/matplotlib/stackplot.py index bdcb505bf745..ce7770cb8e55 100644 --- a/lib/matplotlib/stackplot.py +++ b/lib/matplotlib/stackplot.py @@ -54,7 +54,7 @@ def stackplot(axes, x, *args, Returns ------- - list : list of `.PolyCollection` + list of `.PolyCollection` A list of `.PolyCollection` instances, one for each element in the stacked area plot. """ diff --git a/lib/matplotlib/streamplot.py b/lib/matplotlib/streamplot.py index 0477ec00c227..b4f43dd00623 100644 --- a/lib/matplotlib/streamplot.py +++ b/lib/matplotlib/streamplot.py @@ -71,7 +71,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, Returns ------- - stream_container : StreamplotSet + StreamplotSet Container object with attributes - ``lines``: `.LineCollection` of streamlines diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index f0c8c9c00eaa..a35fe8314d5c 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -342,7 +342,7 @@ def add_cell(self, row, col, *args, **kwargs): Returns ------- - cell : `.CustomCell` + `.CustomCell` The created cell. """ @@ -726,17 +726,17 @@ def table(ax, The cell edges to be drawn with a line. See also `~.CustomCell.visible_edges`. + Returns + ------- + `~matplotlib.table.Table` + The created table. + Other Parameters ---------------- **kwargs `.Table` properties. %(Table)s - - Returns - ------- - table : `~matplotlib.table.Table` - The created table. """ if cellColours is None and cellText is None: diff --git a/lib/matplotlib/testing/compare.py b/lib/matplotlib/testing/compare.py index b653369bb495..1f14f81edcdd 100644 --- a/lib/matplotlib/testing/compare.py +++ b/lib/matplotlib/testing/compare.py @@ -240,7 +240,7 @@ def comparable_formats(): Returns ------- - supported_formats : list of str + list of str E.g. ``['png', 'pdf', 'svg', 'eps']``. """ @@ -335,7 +335,7 @@ def compare_images(expected, actual, tol, in_decorator=False): Returns ------- - comparison_result : None or dict or str + None or dict or str Return *None* if the images are equal within the given tolerance. If the images differ, the return value depends on *in_decorator*. diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index f1ff53f8d9f1..3e8f2eb8d82c 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1308,7 +1308,7 @@ def __call__(self, renderer): Returns ------- - transform : `Transform` + `Transform` Maps (x, y) in pixel or point units to screen units relative to the given artist. """ @@ -1705,7 +1705,7 @@ def transform(renderer) -> Transform Returns ------- - annotation : `.Annotation` + `.Annotation` See Also -------- diff --git a/lib/matplotlib/textpath.py b/lib/matplotlib/textpath.py index 1e0377007e1a..f2bcdaff46ce 100644 --- a/lib/matplotlib/textpath.py +++ b/lib/matplotlib/textpath.py @@ -107,9 +107,12 @@ def get_text_path(self, prop, s, ismath=False): Returns ------- - verts, codes : tuple of lists - *verts* is a list of numpy arrays containing the x and y - coordinates of the vertices. *codes* is a list of path codes. + verts : list + A list of numpy arrays containing the x and y coordinates of the + vertices. + + codes : list + A list of path codes. Examples -------- diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 9df4549baaa2..9873099c13a4 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1431,7 +1431,7 @@ def transform_affine(self, values): Returns ------- - values : array + array The output values as NumPy array of length :attr:`input_dims` or shape (N x :attr:`output_dims`), depending on the input. """ @@ -1456,7 +1456,7 @@ def transform_non_affine(self, values): Returns ------- - values : array + array The output values as NumPy array of length :attr:`input_dims` or shape (N x :attr:`output_dims`), depending on the input. """ @@ -1558,7 +1558,7 @@ def transform_angles(self, angles, pts, radians=False, pushoff=1e-5): Returns ------- - transformed_angles : (N,) array + (N,) array """ # Must be 2D if self.input_dims != 2 or self.output_dims != 2: @@ -2861,7 +2861,7 @@ def offset_copy(trans, fig=None, x=0.0, y=0.0, units='inches'): Returns ------- - trans : `Transform` subclass + `Transform` subclass Transform with applied offset. """ if units == 'dots': diff --git a/lib/matplotlib/tri/triinterpolate.py b/lib/matplotlib/tri/triinterpolate.py index c504edc80ff4..1e2e00188226 100644 --- a/lib/matplotlib/tri/triinterpolate.py +++ b/lib/matplotlib/tri/triinterpolate.py @@ -72,7 +72,7 @@ def __init__(self, triangulation, z, trifinder=None): Returns ------- - z : np.ma.array + np.ma.array Masked array of the same shape as *x* and *y*; values corresponding to (*x*, *y*) points outside of the triangulation are masked out. @@ -149,7 +149,7 @@ def _interpolate_multikeys(self, x, y, tri_index=None, Returns ------- - ret : list of arrays + list of arrays Each array-like contains the expected interpolated values in the order defined by *return_keys* parameter. """ @@ -223,7 +223,7 @@ def _interpolate_single_key(self, return_key, tri_index, x, y): Returns ------- - ret : 1-d array + 1-d array Returned array of the same size as *tri_index* """ raise NotImplementedError("TriInterpolator subclasses" + @@ -464,7 +464,7 @@ def _compute_dof(self, kind, dz=None): Returns ------- - dof : array-like, shape (npts, 2) + array-like, shape (npts, 2) Estimation of the gradient at triangulation nodes (stored as degree of freedoms of reduced-HCT triangle elements). """ @@ -497,7 +497,7 @@ def _get_alpha_vec(x, y, tris_pts): Returns ------- - alpha : array of dim 2 (shape (nx, 3)) + array of dim 2 (shape (nx, 3)) Barycentric coordinates of the points inside the containing triangles. """ @@ -534,7 +534,7 @@ def _get_jacobian(tris_pts): Returns ------- - J : array of dim 3 (shape (nx, 2, 2)) + array of dim 3 (shape (nx, 2, 2)) Barycentric coordinates of the points inside the containing triangles. J[itri, :, :] is the jacobian matrix at apex 0 of the triangle @@ -562,7 +562,7 @@ def _compute_tri_eccentricities(tris_pts): Returns ------- - ecc : array like of dim 2 (shape: (nx, 3)) + array like of dim 2 (shape: (nx, 3)) The so-called eccentricity parameters [1] needed for HCT triangular element. """ diff --git a/lib/matplotlib/tri/tritools.py b/lib/matplotlib/tri/tritools.py index 9fbf657390d1..8f771621fc49 100644 --- a/lib/matplotlib/tri/tritools.py +++ b/lib/matplotlib/tri/tritools.py @@ -35,7 +35,7 @@ def scale_factors(self): Returns ------- - k : (float, float) + (float, float) Scaling factors (kx, ky) so that the triangulation ``[triangulation.x * kx, triangulation.y * ky]`` fits exactly inside a unit square. @@ -70,7 +70,7 @@ def circle_ratios(self, rescale=True): Returns ------- - circle_ratios : masked array + masked array Ratio of the incircle radius over the circumcircle radius, for each 'rescaled' triangle of the encapsulated triangulation. Values corresponding to masked triangles are masked out. @@ -144,7 +144,7 @@ def get_flat_tri_mask(self, min_circle_ratio=0.01, rescale=True): Returns ------- - new_mask : bool array-like + bool array-like Mask to apply to encapsulated triangulation. All the initially masked triangles remain masked in the *new_mask*. @@ -273,7 +273,7 @@ def _total_to_compress_renum(mask, n=None): Returns ------- - renum : int array + int array array so that (`valid_array` being a compressed array based on a `masked_array` with mask *mask*): diff --git a/lib/matplotlib/type1font.py b/lib/matplotlib/type1font.py index 343131eccdfd..eb69cd1a424b 100644 --- a/lib/matplotlib/type1font.py +++ b/lib/matplotlib/type1font.py @@ -325,7 +325,7 @@ def transform(self, effects): Returns ------- - font : `Type1Font` + `Type1Font` """ tokenizer = self._tokens(self.parts[0]) transformed = self._transformer(tokenizer, diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 3fca22c6d208..9877955ccd3e 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -473,7 +473,7 @@ def on_changed(self, func): Returns ------- - cid : int + int Connection id (which can be used to disconnect *func*) """ cid = self.cnt