diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py index 51a7cafc2e73..a05b3a583a54 100644 --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1,5 +1,5 @@ """ -This is an object-oriented plotting library. +An object-oriented plotting library. A procedural interface is provided by the companion pyplot module, which may be imported directly, e.g.:: diff --git a/lib/matplotlib/_constrained_layout.py b/lib/matplotlib/_constrained_layout.py index bb20713700dc..c7f5682bdc1f 100644 --- a/lib/matplotlib/_constrained_layout.py +++ b/lib/matplotlib/_constrained_layout.py @@ -1,18 +1,16 @@ """ -This module provides the routine to adjust subplot layouts so that there are -no overlapping axes or axes decorations. All axes decorations are dealt with -(labels, ticks, titles, ticklabels) and some dependent artists are also dealt -with (colorbar, suptitle, legend). - -Layout is done via :meth:`~matplotlib.gridspec`, with one constraint per -gridspec, so it is possible to have overlapping axes if the gridspecs -overlap (i.e. using :meth:`~matplotlib.gridspec.GridSpecFromSubplotSpec`). -Axes placed using ``figure.subplots()`` or ``figure.add_subplots()`` will -participate in the layout. Axes manually placed via ``figure.add_axes()`` -will not. +Adjust subplot layouts so that there are no overlapping axes or axes +decorations. All axes decorations are dealt with (labels, ticks, titles, +ticklabels) and some dependent artists are also dealt with (colorbar, suptitle, +legend). -See Tutorial: :doc:`/tutorials/intermediate/constrainedlayout_guide` +Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec, +so it is possible to have overlapping axes if the gridspecs overlap (i.e. +using `~matplotlib.gridspec.GridSpecFromSubplotSpec`). Axes placed using +``figure.subplots()`` or ``figure.add_subplots()`` will participate in the +layout. Axes manually placed via ``figure.add_axes()`` will not. +See Tutorial: :doc:`/tutorials/intermediate/constrainedlayout_guide` """ # Development Notes: diff --git a/lib/matplotlib/afm.py b/lib/matplotlib/afm.py index dc33f0300766..ba89775d6d71 100644 --- a/lib/matplotlib/afm.py +++ b/lib/matplotlib/afm.py @@ -1,14 +1,16 @@ """ -This is a python interface to Adobe Font Metrics Files. Although a -number of other python implementations exist, and may be more complete -than this, it was decided not to go with them because they were either: +A python interface to Adobe Font Metrics Files. + +Although a number of other python implementations exist, and may be more +complete than this, it was decided not to go with them because they were +either: 1) copyrighted or used a non-BSD compatible license 2) had too many dependencies and a free standing lib was needed 3) did more than needed and it was easier to write afresh rather than figure out how to get just what was needed. -It is pretty easy to use, and requires only built-in python libs: +It is pretty easy to use, and has no external depedencies: >>> import matplotlib as mpl >>> from pathlib import Path diff --git a/lib/matplotlib/animation.py b/lib/matplotlib/animation.py index c0418c227332..a02a94359089 100644 --- a/lib/matplotlib/animation.py +++ b/lib/matplotlib/animation.py @@ -890,12 +890,10 @@ def finish(self): class Animation: """ - This class wraps the creation of an animation using matplotlib. + A base class for Animations. - It is only a base class which should be subclassed to provide - needed behavior. - - This class is not typically used directly. + This class is not usable as is, and should be subclassed to provide needed + behavior. Parameters ---------- diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index ce8be45f18d5..60933cf9243f 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -2763,9 +2763,10 @@ def draw(self, renderer=None, inframe=False): def draw_artist(self, a): """ - This method can only be used after an initial draw which - caches the renderer. It is used to efficiently update Axes - data (axis ticks, labels, etc are not updated). + Efficiently redraw a single artist. + + This method can only be used after an initial draw which caches the + renderer. """ if self.figure._cachedRenderer is None: raise AttributeError("draw_artist can only be used after an " @@ -2774,9 +2775,10 @@ def draw_artist(self, a): def redraw_in_frame(self): """ - This method can only be used after an initial draw which - caches the renderer. It is used to efficiently update Axes - data (axis ticks, labels, etc are not updated). + Efficiently redraw Axes data, but not axis ticks, labels, etc. + + This method can only be used after an initial draw which caches the + renderer. """ if self.figure._cachedRenderer is None: raise AttributeError("redraw_in_frame can only be used after an " diff --git a/lib/matplotlib/axes/_subplots.py b/lib/matplotlib/axes/_subplots.py index 90511e58b394..bba7d871e1fc 100644 --- a/lib/matplotlib/axes/_subplots.py +++ b/lib/matplotlib/axes/_subplots.py @@ -179,7 +179,7 @@ def _make_twin_axes(self, *args, **kwargs): @functools.lru_cache(None) def subplot_class_factory(axes_class=None): """ - This makes a new class that inherits from `.SubplotBase` and the + Make a new class that inherits from `.SubplotBase` and the given axes_class (which is assumed to be a subclass of `.axes.Axes`). This is perhaps a little bit roundabout to make a new class on the fly like this, but it means that a new Subplot class does @@ -207,8 +207,9 @@ def subplot_class_factory(axes_class=None): def _picklable_subplot_class_constructor(axes_class): """ - This stub class exists to return the appropriate subplot class when called - with an axes class. This is purely to allow pickling of Axes and Subplots. + Stub factory that returns an empty instance of the appropriate subplot + class when called with an axes class. This is purely to allow pickling of + Axes and Subplots. """ subplot_class = subplot_class_factory(axes_class) return subplot_class.__new__(subplot_class) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index f494ee167975..36b99bd19fb4 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -237,9 +237,8 @@ def draw_quad_mesh(self, gc, master_transform, meshWidth, meshHeight, coordinates, offsets, offsetTrans, facecolors, antialiased, edgecolors): """ - This provides a fallback implementation of - :meth:`draw_quad_mesh` that generates paths and then calls - :meth:`draw_path_collection`. + Fallback implementation of :meth:`draw_quad_mesh` that generates paths + and then calls :meth:`draw_path_collection`. """ from matplotlib.collections import QuadMesh @@ -298,9 +297,8 @@ def draw_gouraud_triangles(self, gc, triangles_array, colors_array, def _iter_collection_raw_paths(self, master_transform, paths, all_transforms): """ - This is a helper method (along with :meth:`_iter_collection`) to make - it easier to write a space-efficient :meth:`draw_path_collection` - implementation in a backend. + Helper method (along with :meth:`_iter_collection`) to implement + :meth:`draw_path_collection` in a space-efficient manner. This method yields all of the base path/transform combinations, given a master transform, a list of paths and @@ -348,10 +346,8 @@ def _iter_collection(self, gc, master_transform, all_transforms, edgecolors, linewidths, linestyles, antialiaseds, urls, offset_position): """ - This is a helper method (along with - :meth:`_iter_collection_raw_paths`) to make it easier to write - a space-efficient :meth:`draw_path_collection` implementation in a - backend. + Helper method (along with :meth:`_iter_collection_raw_paths`) to + implement :meth:`draw_path_collection` in a space-efficient manner. This method yields all of the path, offset and graphics context combinations to draw the path collection. The caller diff --git a/lib/matplotlib/backends/backend_template.py b/lib/matplotlib/backends/backend_template.py index 19c8c822274b..bd5cab86deb3 100644 --- a/lib/matplotlib/backends/backend_template.py +++ b/lib/matplotlib/backends/backend_template.py @@ -1,5 +1,5 @@ """ -This is a fully functional do nothing backend to provide a template to backend +A fully functional, do-nothing backend intended as a template for backend writers. It is fully functional in that you can select it as a backend e.g. with :: diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 4114be06d16e..bf74e5dac589 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -1026,9 +1026,9 @@ def Destroy(self, *args, **kwargs): class FigureManagerWx(FigureManagerBase): """ - This class contains the FigureCanvas and GUI frame + Container/controller for the FigureCanvas and GUI frame. - It is instantiated by GcfWx whenever a new figure is created. GcfWx is + It is instantiated by Gcf whenever a new figure is created. Gcf is responsible for managing multiple instances of FigureManagerWx. Attributes diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py index 6081ca15bd09..962a7f94cdc3 100644 --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -170,7 +170,7 @@ def prepare_data(d, init): datalist.append((mappables, "Images, etc.", "")) def apply_callback(data): - """This function will be called to apply changes""" + """A callback to apply changes.""" orig_xlim = axes.get_xlim() orig_ylim = axes.get_ylim() diff --git a/lib/matplotlib/blocking_input.py b/lib/matplotlib/blocking_input.py index 615b31baf172..2d572d338e0f 100644 --- a/lib/matplotlib/blocking_input.py +++ b/lib/matplotlib/blocking_input.py @@ -1,6 +1,5 @@ """ -This provides several classes used for blocking interaction with figure -windows: +Classes used for blocking interaction with figure windows: `BlockingInput` Creates a callable object to retrieve events in a blocking way for diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index 93141da30d0d..20fa2d5eba5d 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -758,9 +758,7 @@ def recurse(obj, start, all, current_path): class Grouper: """ - This class provides a lightweight way to group arbitrary objects - together into disjoint sets when a full-blown graph data structure - would be overkill. + A disjoint-set data structure. Objects can be joined using :meth:`join`, tested for connectedness using :meth:`joined`, and all disjoint sets can be retrieved by @@ -768,30 +766,30 @@ class Grouper: The objects being joined must be hashable and weak-referenceable. - For example: - - >>> from matplotlib.cbook import Grouper - >>> class Foo: - ... def __init__(self, s): - ... self.s = s - ... def __repr__(self): - ... return self.s - ... - >>> a, b, c, d, e, f = [Foo(x) for x in 'abcdef'] - >>> grp = Grouper() - >>> grp.join(a, b) - >>> grp.join(b, c) - >>> grp.join(d, e) - >>> sorted(map(tuple, grp)) - [(a, b, c), (d, e)] - >>> grp.joined(a, b) - True - >>> grp.joined(a, c) - True - >>> grp.joined(a, d) - False - + Examples + -------- + >>> from matplotlib.cbook import Grouper + >>> class Foo: + ... def __init__(self, s): + ... self.s = s + ... def __repr__(self): + ... return self.s + ... + >>> a, b, c, d, e, f = [Foo(x) for x in 'abcdef'] + >>> grp = Grouper() + >>> grp.join(a, b) + >>> grp.join(b, c) + >>> grp.join(d, e) + >>> sorted(map(tuple, grp)) + [(a, b, c), (d, e)] + >>> grp.joined(a, b) + True + >>> grp.joined(a, c) + True + >>> grp.joined(a, d) + False """ + def __init__(self, init=()): self._mapping = {weakref.ref(x): [weakref.ref(x)] for x in init} diff --git a/lib/matplotlib/cm.py b/lib/matplotlib/cm.py index 137107cfd368..f3787c11bba0 100644 --- a/lib/matplotlib/cm.py +++ b/lib/matplotlib/cm.py @@ -150,11 +150,12 @@ def get_cmap(name=None, lut=None): class ScalarMappable: """ - This is a mixin class to support scalar data to RGBA mapping. - The ScalarMappable makes use of data normalization before returning - RGBA colors from the given colormap. + A mixin class to map scalar data to RGBA. + The ScalarMappable applies data normalization before returning RGBA colors + from the given colormap. """ + def __init__(self, norm=None, cmap=None): """ diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py index b551b10b2d5e..f5856a7b6352 100644 --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -1118,7 +1118,7 @@ def set_verts(self, verts, closed=True): set_paths = set_verts def set_verts_and_codes(self, verts, codes): - """This allows one to initialize vertices with path codes.""" + """Initialize vertices with path codes.""" if len(verts) != len(codes): raise ValueError("'codes' must be a 1D list or array " "with the same length of 'verts'") diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py index 0520ba5cb0ff..8e250b14f030 100644 --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -297,8 +297,6 @@ class _ColorbarLogLocator(ticker.LogLocator): """ def __init__(self, colorbar, *args, **kwargs): """ - _ColorbarLogLocator(colorbar, *args, **kwargs) - This ticker needs to know the *colorbar* so that it can access its *vmin* and *vmax*. Otherwise it is the same as `~.ticker.LogLocator`. The ``*args`` and ``**kwargs`` are the diff --git a/lib/matplotlib/colors.py b/lib/matplotlib/colors.py index e6a71be9d4d4..785e63409bd3 100644 --- a/lib/matplotlib/colors.py +++ b/lib/matplotlib/colors.py @@ -361,7 +361,7 @@ def to_hex(c, keep_alpha=False): class ColorConverter: """ - This class is only kept for backwards compatibility. + A class only kept for backwards compatibility. Its functionality is entirely provided by module-level functions. """ diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py index 8c67d09f0c72..40a1d2b0f62d 100644 --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1,5 +1,5 @@ """ -These are classes to support contour plotting and labelling for the Axes class. +Classes to support contour plotting and labelling for the Axes class. """ from numbers import Integral @@ -313,21 +313,22 @@ def locate_label(self, linecontour, labelwidth): def calc_label_rot_and_inline(self, slc, ind, lw, lc=None, spacing=5): """ - This function calculates the appropriate label rotation given - the linecontour coordinates in screen units, the index of the - label location and the label width. + Calculate the appropriate label rotation given the linecontour + coordinates in screen units, the index of the label location and the + label width. - It will also break contour and calculate inlining if *lc* is - not empty (lc defaults to the empty list if None). *spacing* - is the space around the label in pixels to leave empty. + If *lc* is not None or empty, also break contours and compute + inlining. - Do both of these tasks at once to avoid calculating path lengths + *spacing* is the empty space to leave around the label, in pixels. + + Both tasks are done together to avoid calculating path lengths multiple times, which is relatively costly. - The method used here involves calculating the path length - along the contour in pixel coordinates and then looking - approximately label width / 2 away from central point to - determine rotation and then to break contour if desired. + The method used here involves computing the path length along the + contour in pixel coordinates and then looking approximately (label + width / 2) away from central point to determine rotation and then to + break contour if desired. """ if lc is None: diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py index 0ca6a43b5e4a..b27e11541815 100644 --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -563,7 +563,7 @@ def __call__(self, x, pos=0): class ConciseDateFormatter(ticker.Formatter): """ - This class attempts to figure out the best format to use for the + A `.Formatter` which attempts to figure out the best format to use for the date, and to make it as compact as possible, but still be complete. This is most useful when used with the `AutoDateLocator`:: @@ -761,8 +761,8 @@ def format_data_short(self, value): class AutoDateFormatter(ticker.Formatter): """ - This class attempts to figure out the best format to use. This is - most useful when used with the `AutoDateLocator`. + A `.Formatter` which attempts to figure out the best format to use. This + is most useful when used with the `AutoDateLocator`. The AutoDateFormatter has a scale dictionary that maps the scale of the tick (the distance in days between one major tick) and a diff --git a/lib/matplotlib/legend_handler.py b/lib/matplotlib/legend_handler.py index 76789d68ff2b..2ec677884a60 100644 --- a/lib/matplotlib/legend_handler.py +++ b/lib/matplotlib/legend_handler.py @@ -1,5 +1,5 @@ """ -This module defines default legend handlers. +Default legend handlers. It is strongly encouraged to have read the :doc:`legend guide ` before this documentation. @@ -21,7 +21,6 @@ derived from the base class (HandlerBase) with the following method:: def legend_artist(self, legend, orig_handle, fontsize, handlebox) - """ from itertools import cycle diff --git a/lib/matplotlib/lines.py b/lib/matplotlib/lines.py index 092ec36ff991..c13cc16ea44e 100644 --- a/lib/matplotlib/lines.py +++ b/lib/matplotlib/lines.py @@ -1,6 +1,6 @@ """ -This module contains all the 2D line class which can draw with a -variety of line styles, markers and colors. +The 2D line class which can draw with a variety of line styles, markers and +colors. """ # TODO: expose cap and join style attrs diff --git a/lib/matplotlib/markers.py b/lib/matplotlib/markers.py index eb7019f31195..afa8c105e3c4 100644 --- a/lib/matplotlib/markers.py +++ b/lib/matplotlib/markers.py @@ -1,7 +1,6 @@ r""" -This module contains functions to handle markers. Used by both the -marker functionality of `~matplotlib.axes.Axes.plot` and -`~matplotlib.axes.Axes.scatter`. +Functions to handle markers; used by the marker functionality of +`~matplotlib.axes.Axes.plot` and `~matplotlib.axes.Axes.scatter`. All possible markers are defined here: diff --git a/lib/matplotlib/mathtext.py b/lib/matplotlib/mathtext.py index 42a75c792c82..586c4d0a75da 100644 --- a/lib/matplotlib/mathtext.py +++ b/lib/matplotlib/mathtext.py @@ -2276,9 +2276,9 @@ def raise_error(s, loc, toks): class Parser: """ - This is the pyparsing-based parser for math expressions. It - actually parses full strings *containing* math expressions, in - that raw text may also appear outside of pairs of ``$``. + A pyparsing-based parser for strings containing math expressions. + + Raw text may also appear outside of pairs of ``$``. The grammar is based directly on that in TeX, though it cuts a few corners. """ diff --git a/lib/matplotlib/mlab.py b/lib/matplotlib/mlab.py index 3d0d71769fcc..f24035fc0cdf 100644 --- a/lib/matplotlib/mlab.py +++ b/lib/matplotlib/mlab.py @@ -406,9 +406,8 @@ def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None, window=None, noverlap=None, pad_to=None, sides=None, scale_by_freq=None, mode=None): """ - This is a helper function that implements the commonality between the - psd, csd, spectrogram and complex, magnitude, angle, and phase spectrums. - It is *NOT* meant to be used outside of mlab and may change at any time. + Private helper implementing the common parts between the psd, csd, + spectrogram and complex, magnitude, angle, and phase spectrums. """ if y is None: # if y is None use x for y @@ -564,9 +563,8 @@ def _spectral_helper(x, y=None, NFFT=None, Fs=None, detrend_func=None, def _single_spectrum_helper( mode, x, Fs=None, window=None, pad_to=None, sides=None): """ - This is a helper function that implements the commonality between the - complex, magnitude, angle, and phase spectrums. - It is *NOT* meant to be used outside of mlab and may change at any time. + Private helper implementing the commonality between the complex, magnitude, + angle, and phase spectrums. """ cbook._check_in_list(['complex', 'magnitude', 'angle', 'phase'], mode=mode) diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index 3c9892d9d039..65195b1b724c 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -1751,7 +1751,7 @@ def segment_circle_intersect(x0, y0, x1, y1): def bbox_artist(artist, renderer, props=None, fill=True): """ - This is a debug function to draw a rectangle around the bounding + A debug function to draw a rectangle around the bounding box returned by an artist's `.Artist.get_window_extent` to test whether the artist is returning the correct bbox. @@ -1782,7 +1782,7 @@ def bbox_artist(artist, renderer, props=None, fill=True): def draw_bbox(bbox, renderer, color='k', trans=None): """ - This is a debug function to draw a rectangle around the bounding + A debug function to draw a rectangle around the bounding box returned by an artist's `.Artist.get_window_extent` to test whether the artist is returning the correct bbox. """ diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index 07da27e1d438..22cbf966179d 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -626,7 +626,7 @@ def figure(num=None, # autoincrement if None, else integer from 1-N def _auto_draw_if_interactive(fig, val): """ - This is an internal helper function for making sure that auto-redrawing + An internal helper function for making sure that auto-redrawing works as intended in the plain python repl. Parameters diff --git a/lib/matplotlib/quiver.py b/lib/matplotlib/quiver.py index 673424d104e5..08d35e49abef 100644 --- a/lib/matplotlib/quiver.py +++ b/lib/matplotlib/quiver.py @@ -1013,48 +1013,48 @@ def _find_tails(self, mag, rounding=True, half=5, full=10, flag=50): def _make_barbs(self, u, v, nflags, nbarbs, half_barb, empty_flag, length, pivot, sizes, fill_empty, flip): """ - This function actually creates the wind barbs. *u* and *v* - are components of the vector in the *x* and *y* directions, - respectively. + Create the wind barbs. - *nflags*, *nbarbs*, and *half_barb*, empty_flag* are, - *respectively, the number of flags, number of barbs, flag for - *half a barb, and flag for empty barb, ostensibly obtained - *from :meth:`_find_tails`. - - *length* is the length of the barb staff in points. - - *pivot* specifies the point on the barb around which the - entire barb should be rotated. Right now, valid options are - 'tip' and 'middle'. Can also be a number, which shifts the start - of the barb that many points from the origin. - - *sizes* is a dictionary of coefficients specifying the ratio - of a given feature to the length of the barb. These features - include: - - - *spacing*: space between features (flags, full/half - barbs) - - - *height*: distance from shaft of top of a flag or full - barb - - - *width* - width of a flag, twice the width of a full barb - - - *emptybarb* - radius of the circle used for low - magnitudes - - *fill_empty* specifies whether the circle representing an - empty barb should be filled or not (this changes the drawing - of the polygon). - - *flip* is a flag indicating whether the features should be flipped to - the other side of the barb (useful for winds in the southern - hemisphere). - - This function returns list of arrays of vertices, defining a polygon - for each of the wind barbs. These polygons have been rotated to - properly align with the vector direction. + Parameters + ---------- + u, v + Components of the vector in the x and y directions, respectively. + + nflags, nbarbs, half_barb, empty_flag + Respectively, the number of flags, number of barbs, flag for + half a barb, and flag for empty barb, ostensibly obtained from + :meth:`_find_tails`. + + length + The length of the barb staff in points. + + pivot : {"tip", "middle"} or number + The point on the barb around which the entire barb should be + rotated. If a number, the start of the barb is shifted by that + many points from the origin. + + sizes : dict + Coefficients specifying the ratio of a given feature to the length + of the barb. These features include: + + - *spacing*: space between features (flags, full/half barbs). + - *height*: distance from shaft of top of a flag or full barb. + - *width*: width of a flag, twice the width of a full barb. + - *emptybarb*: radius of the circle used for low magnitudes. + + fill_empty : bool + Whether the circle representing an empty barb should be filled or + not (this changes the drawing of the polygon). + + flip : list of bool + Whether the features should be flipped to the other side of the + barb (useful for winds in the southern hemisphere). + + Returns + ------- + list of arrays of vertices + Polygon vertices for each of the wind barbs. These polygons have + been rotated to properly align with the vector direction. """ # These control the spacing and size of barb elements relative to the diff --git a/lib/matplotlib/table.py b/lib/matplotlib/table.py index 846c77960a1d..94337489a882 100644 --- a/lib/matplotlib/table.py +++ b/lib/matplotlib/table.py @@ -7,7 +7,7 @@ # Copyright The Matplotlib development team """ -This module provides functionality to add a table to a plot. +Tables drawing. Use the factory function `~matplotlib.table.table` to create a ready-made table from texts. If you need more control, use the `.Table` class and its diff --git a/lib/matplotlib/testing/jpl_units/__init__.py b/lib/matplotlib/testing/jpl_units/__init__.py index 45fa99e0e573..b8caa9a8957a 100644 --- a/lib/matplotlib/testing/jpl_units/__init__.py +++ b/lib/matplotlib/testing/jpl_units/__init__.py @@ -1,6 +1,6 @@ """ -This is a sample set of units for use with testing unit conversion -of matplotlib routines. These are used because they use very strict +A sample set of units for use with testing unit conversion +of Matplotlib routines. These are used because they use very strict enforcement of unitized data which will test the entire spectrum of how unitized data might be used (it is not always meaningful to convert to a float without specific units given). diff --git a/lib/matplotlib/tests/tinypages/range6.py b/lib/matplotlib/tests/tinypages/range6.py index d7de4cfc9be4..fa5d035e4ab2 100644 --- a/lib/matplotlib/tests/tinypages/range6.py +++ b/lib/matplotlib/tests/tinypages/range6.py @@ -2,12 +2,12 @@ def range4(): - """This is never be called if plot_directive works as expected.""" + """Never called if plot_directive works as expected.""" raise NotImplementedError def range6(): - """This is the function that should be executed.""" + """The function that should be executed.""" plt.figure() plt.plot(range(6)) plt.show() diff --git a/lib/matplotlib/texmanager.py b/lib/matplotlib/texmanager.py index 1685b955352a..6740497e8bb1 100644 --- a/lib/matplotlib/texmanager.py +++ b/lib/matplotlib/texmanager.py @@ -1,8 +1,7 @@ r""" -This module supports embedded TeX expressions in matplotlib via dvipng -and dvips for the raster and postscript backends. The tex and -dvipng/dvips information is cached in ~/.matplotlib/tex.cache for reuse between -sessions +Support for embedded TeX expressions in Matplotlib via dvipng and dvips for the +raster and PostScript backends. The tex and dvipng/dvips information is cached +in ~/.matplotlib/tex.cache for reuse between sessions. Requirements: diff --git a/lib/matplotlib/tight_bbox.py b/lib/matplotlib/tight_bbox.py index 932352139704..d05ce7ec9135 100644 --- a/lib/matplotlib/tight_bbox.py +++ b/lib/matplotlib/tight_bbox.py @@ -1,5 +1,5 @@ """ -This module is to support the *bbox_inches* parameter in `.Figure.savefig`. +Helper module for the *bbox_inches* parameter in `.Figure.savefig`. """ from matplotlib.transforms import Bbox, TransformedBbox, Affine2D @@ -73,8 +73,8 @@ def restore_bbox(): def process_figure_for_rasterizing(fig, bbox_inches_restore, fixed_dpi=None): """ - This need to be called when figure dpi changes during the drawing - (e.g., rasterizing). It recovers the bbox and re-adjust it with + A function that needs to be called when figure dpi changes during the + drawing (e.g., rasterizing). It recovers the bbox and re-adjust it with the new dpi. """ diff --git a/lib/matplotlib/tight_layout.py b/lib/matplotlib/tight_layout.py index 8bd7e81bcc3a..387c23b1b65f 100644 --- a/lib/matplotlib/tight_layout.py +++ b/lib/matplotlib/tight_layout.py @@ -1,9 +1,9 @@ """ -This module provides routines to adjust subplot params so that subplots are +Routines to adjust subplot params so that subplots are nicely fit in the figure. In doing so, only axis labels, tick labels, axes titles and offsetboxes that are anchored to axes are currently considered. -Internally, it assumes that the margins (left_margin, etc.) which are +Internally, this module assumes that the margins (left_margin, etc.) which are differences between ax.get_tightbbox and ax.bbox are independent of axes position. This may fail if Axes.adjustable is datalim. Also, This will fail for some cases (for example, left or right margin is affected by xlabel). diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index e22fba148234..f63fe75c0742 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -1,5 +1,5 @@ """ -matplotlib includes a framework for arbitrary geometric +Matplotlib includes a framework for arbitrary geometric transformations that is used determine the final position of all elements drawn on the canvas. @@ -211,14 +211,16 @@ def frozen(self): class BboxBase(TransformNode): """ - This is the base class of all bounding boxes, and provides read-only access - to its data. A mutable bounding box is provided by the `Bbox` class. + The base class of all bounding boxes. + + This class is immutable; `Bbox` is a mutable subclass. The canonical representation is as two points, with no restrictions on their ordering. Convenience properties are provided to get the left, bottom, right and top edges and width and height, but these are not stored explicitly. """ + is_bbox = True is_affine = True diff --git a/lib/matplotlib/tri/trirefine.py b/lib/matplotlib/tri/trirefine.py index 542fb006cb61..7c2f6535ee96 100644 --- a/lib/matplotlib/tri/trirefine.py +++ b/lib/matplotlib/tri/trirefine.py @@ -171,10 +171,10 @@ def refine_field(self, z, triinterpolator=None, subdiv=3): @staticmethod def _refine_triangulation_once(triangulation, ancestors=None): """ - This function refines a matplotlib.tri *triangulation* by splitting - each triangle into 4 child-masked_triangles built on the edges midside - nodes. - The masked triangles, if present, are also split but their children + Refine a `.Triangulation` by splitting each triangle into 4 + child-masked_triangles built on the edges midside nodes. + + Masked triangles, if present, are also split, but their children returned masked. If *ancestors* is not provided, returns only a new triangulation: @@ -186,8 +186,8 @@ def _refine_triangulation_once(triangulation, ancestors=None): (child_triangulation, child_ancestors) child_ancestors is defined so that the 4 child masked_triangles share the same index as their father: child_ancestors.shape = (4 * ntri,). - """ + x = triangulation.x y = triangulation.y diff --git a/lib/matplotlib/type1font.py b/lib/matplotlib/type1font.py index eb69cd1a424b..1c09bdcb1ca3 100644 --- a/lib/matplotlib/type1font.py +++ b/lib/matplotlib/type1font.py @@ -1,10 +1,9 @@ """ -This module contains a class representing a Type 1 font. +A class representing a Type 1 font. This version reads pfa and pfb files and splits them for embedding in pdf files. It also supports SlantFont and ExtendFont transformations, -similarly to pdfTeX and friends. There is no support yet for -subsetting. +similarly to pdfTeX and friends. There is no support yet for subsetting. Usage:: diff --git a/lib/mpl_toolkits/axes_grid1/axes_divider.py b/lib/mpl_toolkits/axes_grid1/axes_divider.py index 583a88c73eeb..adfb58199e3f 100644 --- a/lib/mpl_toolkits/axes_grid1/axes_divider.py +++ b/lib/mpl_toolkits/axes_grid1/axes_divider.py @@ -1,13 +1,5 @@ """ -The axes_divider module provides helper classes to adjust the positions of -multiple axes at drawing time. - - Divider: this is the class that is used to calculate the axes - position. It divides the given rectangular area into several sub - rectangles. You initialize the divider by setting the horizontal - and vertical lists of sizes that the division will be based on. You - then use the new_locator method, whose return value is a callable - object that can be used to set the axes_locator of the axes. +Helper classes to adjust the positions of multiple axes at drawing time. """ import numpy as np @@ -21,14 +13,14 @@ class Divider: """ - This class calculates the axes position. It - divides the given rectangular area into several - sub-rectangles. You initialize the divider by setting the - horizontal and vertical lists of sizes - (:mod:`mpl_toolkits.axes_grid1.axes_size`) that the division will - be based on. You then use the new_locator method to create a - callable object that can be used as the axes_locator of the - axes. + An Axes positioning class. + + The divider is initialized with lists of horizontal and vertical sizes + (:mod:`mpl_toolkits.axes_grid1.axes_size`) based on which a given + rectangular area will be divided. + + The `new_locator` method then creates a callable object + that can be used as the *axes_locator* of the axes. """ def __init__(self, fig, pos, horizontal, vertical, @@ -38,17 +30,16 @@ def __init__(self, fig, pos, horizontal, vertical, ---------- fig : Figure pos : tuple of 4 floats - position of the rectangle that will be divided + Position of the rectangle that will be divided. horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size` - sizes for horizontal division + Sizes for horizontal division. vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size` - sizes for vertical division + Sizes for vertical division. aspect : bool - if True, the overall rectangular area is reduced - so that the relative part of the horizontal and - vertical scales have the same scale. + Whether overall rectangular area is reduced so that the relative + part of the horizontal and vertical scales have the same scale. anchor : {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'} - placement of the reduced rectangle when *aspect* is True + Placement of the reduced rectangle, when *aspect* is True. """ self._fig = fig diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py index b0794df878ef..b94213bcfada 100644 --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -839,10 +839,7 @@ def set_zscale(self, value, **kwargs): """) def clabel(self, *args, **kwargs): - """ - This function is currently not implemented for 3D axes. - Returns *None*. - """ + """Currently not implemented for 3D axes, and returns *None*.""" return None def view_init(self, elev=None, azim=None):