From 383de519505964ed879c40b23ef36e90c17ebe0d Mon Sep 17 00:00:00 2001 From: Oscar Gustafsson Date: Sun, 20 Nov 2022 18:53:49 +0100 Subject: [PATCH] [Doc] fix more spelling and grammar --- lib/matplotlib/axes/_axes.py | 58 ++++++++++----------- lib/matplotlib/axes/_base.py | 18 +++---- lib/matplotlib/backends/backend_agg.py | 4 +- lib/matplotlib/backends/backend_pdf.py | 2 +- lib/matplotlib/backends/backend_ps.py | 4 +- lib/matplotlib/backends/backend_qt.py | 6 +-- lib/matplotlib/backends/backend_template.py | 6 +-- lib/matplotlib/backends/backend_wx.py | 4 +- lib/matplotlib/cbook/__init__.py | 6 +-- lib/matplotlib/projections/geo.py | 8 +-- lib/matplotlib/projections/polar.py | 8 +-- lib/matplotlib/tri/_tricontour.py | 2 +- lib/matplotlib/tri/_triinterpolate.py | 2 +- lib/matplotlib/tri/_trirefine.py | 2 +- lib/matplotlib/tri/_tritools.py | 2 +- 15 files changed, 66 insertions(+), 66 deletions(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index ab7e5fcaf2e0..6f7941e61690 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -8,12 +8,12 @@ from numpy import ma import matplotlib as mpl -import matplotlib.category # Register category unit converter as side-effect. +import matplotlib.category # Register category unit converter as side effect. import matplotlib.cbook as cbook import matplotlib.collections as mcoll import matplotlib.colors as mcolors import matplotlib.contour as mcontour -import matplotlib.dates # noqa # Register date unit converter as side-effect. +import matplotlib.dates # noqa # Register date unit converter as side effect. import matplotlib.image as mimage import matplotlib.legend as mlegend import matplotlib.lines as mlines @@ -541,7 +541,7 @@ def indicate_inset_zoom(self, inset_ax, **kwargs): @_docstring.dedent_interpd def secondary_xaxis(self, location, *, functions=None, **kwargs): """ - Add a second x-axis to this Axes. + Add a second x-axis to this `~.axes.Axes`. For example if we want to have a second scale for the data plotted on the xaxis. @@ -583,7 +583,7 @@ def invert(x): @_docstring.dedent_interpd def secondary_yaxis(self, location, *, functions=None, **kwargs): """ - Add a second y-axis to this Axes. + Add a second y-axis to this `~.axes.Axes`. For example if we want to have a second scale for the data plotted on the yaxis. @@ -721,8 +721,8 @@ def axhline(self, y=0, xmin=0, xmax=1, **kwargs): Other Parameters ---------------- **kwargs - Valid keyword arguments are `.Line2D` properties, with the - exception of 'transform': + Valid keyword arguments are `.Line2D` properties, except for + 'transform': %(Line2D:kwdoc)s @@ -789,8 +789,8 @@ def axvline(self, x=0, ymin=0, ymax=1, **kwargs): Other Parameters ---------------- **kwargs - Valid keyword arguments are `.Line2D` properties, with the - exception of 'transform': + Valid keyword arguments are `.Line2D` properties, except for + 'transform': %(Line2D:kwdoc)s @@ -1491,7 +1491,7 @@ def plot(self, *args, scalex=True, scaley=True, data=None, **kwargs): >>> plot(x1, y1, 'g^', x2, y2, 'g-') In this case, any additional keyword argument applies to all - datasets. Also this syntax cannot be combined with the *data* + datasets. Also, this syntax cannot be combined with the *data* parameter. By default, each line is assigned a different style specified by a @@ -1753,7 +1753,7 @@ def plot_date(self, x, y, fmt='o', tz=None, xdate=True, ydate=False, @_docstring.dedent_interpd def loglog(self, *args, **kwargs): """ - Make a plot with log scaling on both the x and y axis. + Make a plot with log scaling on both the x- and y-axis. Call signatures:: @@ -1761,7 +1761,7 @@ def loglog(self, *args, **kwargs): loglog([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs) This is just a thin wrapper around `.plot` which additionally changes - both the x-axis and the y-axis to log scaling. All of the concepts and + both the x-axis and the y-axis to log scaling. All the concepts and parameters of plot can be used here as well. The additional parameters *base*, *subs* and *nonpositive* control the @@ -1807,7 +1807,7 @@ def loglog(self, *args, **kwargs): @_docstring.dedent_interpd def semilogx(self, *args, **kwargs): """ - Make a plot with log scaling on the x axis. + Make a plot with log scaling on the x-axis. Call signatures:: @@ -1815,8 +1815,8 @@ def semilogx(self, *args, **kwargs): semilogx([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs) This is just a thin wrapper around `.plot` which additionally changes - the x-axis to log scaling. All of the concepts and parameters of plot - can be used here as well. + the x-axis to log scaling. All the concepts and parameters of plot can + be used here as well. The additional parameters *base*, *subs*, and *nonpositive* control the x-axis properties. They are just forwarded to `.Axes.set_xscale`. @@ -1854,7 +1854,7 @@ def semilogx(self, *args, **kwargs): @_docstring.dedent_interpd def semilogy(self, *args, **kwargs): """ - Make a plot with log scaling on the y axis. + Make a plot with log scaling on the y-axis. Call signatures:: @@ -1862,8 +1862,8 @@ def semilogy(self, *args, **kwargs): semilogy([x], y, [fmt], [x2], y2, [fmt2], ..., **kwargs) This is just a thin wrapper around `.plot` which additionally changes - the y-axis to log scaling. All of the concepts and parameters of plot - can be used here as well. + the y-axis to log scaling. All the concepts and parameters of plot can + be used here as well. The additional parameters *base*, *subs*, and *nonpositive* control the y-axis properties. They are just forwarded to `.Axes.set_yscale`. @@ -3121,7 +3121,7 @@ def pie(self, x, explode=None, labels=None, colors=None, For example, you can pass in ``wedgeprops = {'linewidth': 3}`` to set the width of the wedge border lines equal to 3. For more details, look at the doc/arguments of the wedge object. - By default ``clip_on=False``. + By default, ``clip_on=False``. textprops : dict, default: None Dict of arguments to pass to the text objects. @@ -3352,7 +3352,7 @@ def errorbar(self, x, y, yerr=None, xerr=None, The format for the data points / data lines. See `.plot` for details. - Use 'none' (case insensitive) to plot errorbars without any data + Use 'none' (case-insensitive) to plot errorbars without any data markers. ecolor : color, default: None @@ -4387,7 +4387,7 @@ def invalid_shape_exception(csize, xsize): c_is_mapped = False if c.size != xsize: valid_shape = False - # If c can be either mapped values or a RGB(A) color, prefer + # If c can be either mapped values or an RGB(A) color, prefer # the former if shapes match, the latter otherwise. elif c.size == xsize: c = c.ravel() @@ -4458,9 +4458,9 @@ def scatter(self, x, y, s=None, c=None, marker=None, cmap=None, norm=None, Note that *c* should not be a single numeric RGB or RGBA sequence because that is indistinguishable from an array of values to be colormapped. If you want to specify the same RGB or RGBA value for - all points, use a 2D array with a single row. Otherwise, value- - matching will have precedence in case of a size matching with *x* - and *y*. + all points, use a 2D array with a single row. Otherwise, + value-matching will have precedence in case of a size matching with + *x* and *y*. If you wish to specify a single color for all points prefer the *color* keyword argument. @@ -5126,7 +5126,7 @@ def _quiver_units(self, args, kwargs): return (x, y) + args[2:] return args - # args can by a combination if X, Y, U, V, C and all should be replaced + # args can be a combination of X, Y, U, V, C and all should be replaced @_preprocess_data() @_docstring.dedent_interpd def quiver(self, *args, **kwargs): @@ -6566,7 +6566,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, equals 1. bottom : array-like, scalar, or None, default: None - Location of the bottom of each bin, ie. bins are drawn from + Location of the bottom of each bin, i.e. bins are drawn from ``bottom`` to ``bottom + hist(x, bins)`` If a scalar, the bottom of each bin is shifted by the same amount. If an array, each bin is shifted independently and the length of bottom must match the @@ -7060,9 +7060,9 @@ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None, histogrammed along the first dimension and values in y are histogrammed along the second dimension. xedges : 1D array - The bin edges along the x axis. + The bin edges along the x-axis. yedges : 1D array - The bin edges along the y axis. + The bin edges along the y-axis. image : `~.matplotlib.collections.QuadMesh` Other Parameters @@ -7653,7 +7653,7 @@ def specgram(self, x, NFFT=None, Fs=None, Fc=None, detrend=None, scale : {'default', 'linear', 'dB'} The scaling of the values in the *spec*. 'linear' is no scaling. 'dB' returns the values in dB scale. When *mode* is 'psd', - this is dB power (10 * log10). Otherwise this is dB amplitude + this is dB power (10 * log10). Otherwise, this is dB amplitude (20 * log10). 'default' is 'dB' if *mode* is 'psd' or 'magnitude' and 'linear' otherwise. This must be 'linear' if *mode* is 'angle' or 'phase'. @@ -8240,7 +8240,7 @@ def violin(self, vpstats, positions=None, vert=True, widths=0.5, table = mtable.table - # args can by either Y or y1, y2, ... and all should be replaced + # args can be either Y or y1, y2, ... and all should be replaced stackplot = _preprocess_data()(mstack.stackplot) streamplot = _preprocess_data( diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py index ec3e8c5433fa..5a57c6ae498c 100644 --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -46,7 +46,7 @@ class _axis_method_wrapper: The docstring of ``get_foo`` is built by replacing "this Axis" by "the {attr_name}" (i.e., "the xaxis", "the yaxis") in the wrapped method's - dedented docstring; additional replacements can by given in *doc_sub*. + dedented docstring; additional replacements can be given in *doc_sub*. """ def __init__(self, attr_name, method_name, *, doc_sub=None): @@ -606,8 +606,8 @@ def __init__(self, fig, `.SubplotSpec` instance. sharex, sharey : `~.axes.Axes`, optional - The x or y `~.matplotlib.axis` is shared with the x or - y axis in the input `~.axes.Axes`. + The x- or y-`~.matplotlib.axis` is shared with the x- or y-axis in + the input `~.axes.Axes`. frameon : bool, default: True Whether the Axes frame is visible. @@ -1093,7 +1093,7 @@ def get_position(self, original=False): Parameters ---------- original : bool - If ``True``, return the original position. Otherwise return the + If ``True``, return the original position. Otherwise, return the active position. For an explanation of the positions see `.set_position`. @@ -1422,7 +1422,7 @@ def __init__(self, axes, prop_name, add_name, """ Parameters ---------- - axes : .axes.Axes + axes : `~matplotlib.axes.Axes` The Axes from which this sublist will pull the children Artists. prop_name : str @@ -1702,7 +1702,7 @@ def set_aspect(self, aspect, adjustable=None, anchor=None, share=False): anchor : None or str or (float, float), optional If not ``None``, this defines where the Axes will be drawn if there - is extra space due to aspect constraints. The most common way to + is extra space due to aspect constraints. The most common way to specify the anchor are abbreviations of cardinal directions: ===== ===================== @@ -2911,10 +2911,10 @@ def autoscale_view(self, tight=None, scalex=True, scaley=True): behaves like True). scalex : bool, default: True - Whether to autoscale the x axis. + Whether to autoscale the x-axis. scaley : bool, default: True - Whether to autoscale the y axis. + Whether to autoscale the y-axis. Notes ----- @@ -3997,7 +3997,7 @@ def format_xdata(self, x): def format_ydata(self, y): """ - Return *y* formatted as an y-value. + Return *y* formatted as a y-value. This function will use the `.fmt_ydata` attribute if it is not None, else will fall back on the yaxis major formatter. diff --git a/lib/matplotlib/backends/backend_agg.py b/lib/matplotlib/backends/backend_agg.py index c7b5b40ef80d..0fe0fc40c00b 100644 --- a/lib/matplotlib/backends/backend_agg.py +++ b/lib/matplotlib/backends/backend_agg.py @@ -335,7 +335,7 @@ def restore_region(self, region, bbox=None, xy=None): def start_filter(self): """ - Start filtering. It simply create a new canvas (the old one is saved). + Start filtering. It simply creates a new canvas (the old one is saved). """ self._filter_renderers.append(self._renderer) self._renderer = _RendererAgg(int(self.width), int(self.height), @@ -344,7 +344,7 @@ def start_filter(self): def stop_filter(self, post_processing): """ - Save the plot in the current canvas as a image and apply + Save the plot in the current canvas as an image and apply the *post_processing* function. def post_processing(image, dpi): diff --git a/lib/matplotlib/backends/backend_pdf.py b/lib/matplotlib/backends/backend_pdf.py index a3ea5dac6e43..7bd0afc4567b 100644 --- a/lib/matplotlib/backends/backend_pdf.py +++ b/lib/matplotlib/backends/backend_pdf.py @@ -2614,7 +2614,7 @@ def clip_cmd(self, cliprect, clippath): def delta(self, other): """ Copy properties of other into self and return PDF commands - needed to transform self into other. + needed to transform *self* into *other*. """ cmds = [] fill_performed = False diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index a2c8b1e45495..7c1a45d385cb 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -870,7 +870,7 @@ def _print_figure( Render the figure to a filesystem path or a file-like object. Parameters are as for `.print_figure`, except that *dsc_comments* is a - all string containing Document Structuring Convention comments, + string containing Document Structuring Convention comments, generated from the *metadata* parameter to `.print_figure`. """ is_eps = fmt == 'eps' @@ -1187,7 +1187,7 @@ def gs_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False): # the original bbox can be restored during the pstoeps step. if eps: - # For some versions of gs, above steps result in an ps file where the + # For some versions of gs, above steps result in a ps file where the # original bbox is no more correct. Do not adjust bbox for now. pstoeps(tmpfile, bbox, rotated=rotated) diff --git a/lib/matplotlib/backends/backend_qt.py b/lib/matplotlib/backends/backend_qt.py index 8f602d71d7c8..c19cc240ba48 100644 --- a/lib/matplotlib/backends/backend_qt.py +++ b/lib/matplotlib/backends/backend_qt.py @@ -103,8 +103,8 @@ class __getattr__: def _create_qApp(): app = QtWidgets.QApplication.instance() - # Create a new QApplication and configure if if non exists yet, as only one - # QApplication can exist at a time. + # Create a new QApplication and configure it if none exists yet, as only + # one QApplication can exist at a time. if app is None: # display_is_valid returns False only if on Linux and neither X11 # nor Wayland display can be opened. @@ -376,7 +376,7 @@ def _get_key(self, event): except KeyError: # Unicode defines code points up to 0x10ffff (sys.maxunicode) # QT will use Key_Codes larger than that for keyboard keys that are - # are not Unicode characters (like multimedia keys) + # not Unicode characters (like multimedia keys) # skip these # if you really want them, you should add them to SPECIAL_KEYS if event_key > sys.maxunicode: diff --git a/lib/matplotlib/backends/backend_template.py b/lib/matplotlib/backends/backend_template.py index 67aea9d811f0..4a6d2a2ca3a7 100644 --- a/lib/matplotlib/backends/backend_template.py +++ b/lib/matplotlib/backends/backend_template.py @@ -10,9 +10,9 @@ produced. This provides a starting point for backend writers; you can selectively implement drawing methods (`~.RendererTemplate.draw_path`, `~.RendererTemplate.draw_image`, etc.) and slowly see your figure come to life -instead having to have a full blown implementation before getting any results. +instead having to have a full-blown implementation before getting any results. -Copy this file to a directory outside of the Matplotlib source tree, somewhere +Copy this file to a directory outside the Matplotlib source tree, somewhere where Python can import it (by adding the directory to your ``sys.path`` or by packaging it as a normal Python package); if the backend is importable as ``import my.backend`` you can then select it using :: @@ -122,7 +122,7 @@ class GraphicsContextTemplate(GraphicsContextBase): do the mapping here, you'll need to override several of the setter methods. - The base GraphicsContext stores colors as a RGB tuple on the unit + The base GraphicsContext stores colors as an RGB tuple on the unit interval, e.g., (0.5, 0.0, 1.0). You may need to map this to colors appropriate for your backend. """ diff --git a/lib/matplotlib/backends/backend_wx.py b/lib/matplotlib/backends/backend_wx.py index 00d671a3cb8d..0333f512ae66 100644 --- a/lib/matplotlib/backends/backend_wx.py +++ b/lib/matplotlib/backends/backend_wx.py @@ -303,7 +303,7 @@ class GraphicsContextWx(GraphicsContextBase): seems to be fairly heavy, so these objects are cached based on the bitmap object that is passed in. - The base GraphicsContext stores colors as a RGB tuple on the unit + The base GraphicsContext stores colors as an RGB tuple on the unit interval, e.g., (0.5, 0.0, 1.0). wxPython uses an int interval, but since wxPython colour management is rather simple, I have not chosen to implement a separate colour manager class. @@ -398,7 +398,7 @@ def set_joinstyle(self, js): self.unselect() def get_wxcolour(self, color): - """Convert a RGB(A) color to a wx.Colour.""" + """Convert an RGB(A) color to a wx.Colour.""" _log.debug("%s - get_wx_color()", type(self)) return wx.Colour(*[int(255 * x) for x in color]) diff --git a/lib/matplotlib/cbook/__init__.py b/lib/matplotlib/cbook/__init__.py index e48f0401178b..c9540d29cfaf 100644 --- a/lib/matplotlib/cbook/__init__.py +++ b/lib/matplotlib/cbook/__init__.py @@ -1475,7 +1475,7 @@ def violin_stats(X, method, points=100, quantiles=None): else: quantiles = [[]] * len(X) - # quantiles should has the same size as dataset + # quantiles should have the same size as dataset if len(X) != len(quantiles): raise ValueError("List of violinplot statistics and quantiles values" " must have the same length") @@ -1666,7 +1666,7 @@ def safe_first_element(obj): """ Return the first element in *obj*. - This is an type-independent way of obtaining the first element, + This is a type-independent way of obtaining the first element, supporting both index access and the iterator protocol. """ return _safe_first_finite(obj, skip_nonfinite=False) @@ -1678,7 +1678,7 @@ def _safe_first_finite(obj, *, skip_nonfinite=True): This is a method for internal use. - This is an type-independent way of obtaining the first non-None element, + This is a type-independent way of obtaining the first non-None element, supporting both index access and the iterator protocol. The first non-None element will be obtained when skip_none is True. """ diff --git a/lib/matplotlib/projections/geo.py b/lib/matplotlib/projections/geo.py index c9eaaea703e7..74ca7f9c3d7f 100644 --- a/lib/matplotlib/projections/geo.py +++ b/lib/matplotlib/projections/geo.py @@ -199,17 +199,17 @@ def get_data_ratio(self): def can_zoom(self): """ - Return whether this axes supports the zoom box button functionality. + Return whether this Axes supports the zoom box button functionality. - This axes object does not support interactive zoom box. + This Axes object does not support interactive zoom box. """ return False def can_pan(self): """ - Return whether this axes supports the pan/zoom button functionality. + Return whether this Axes supports the pan/zoom button functionality. - This axes object does not support interactive pan/zoom. + This Axes object does not support interactive pan/zoom. """ return False diff --git a/lib/matplotlib/projections/polar.py b/lib/matplotlib/projections/polar.py index f5c42d4e7bed..b64c57afc828 100644 --- a/lib/matplotlib/projections/polar.py +++ b/lib/matplotlib/projections/polar.py @@ -1363,17 +1363,17 @@ def get_data_ratio(self): def can_zoom(self): """ - Return whether this axes supports the zoom box button functionality. + Return whether this Axes supports the zoom box button functionality. - Polar axes do not support zoom boxes. + A polar Axes does not support zoom boxes. """ return False def can_pan(self): """ - Return whether this axes supports the pan/zoom button functionality. + Return whether this Axes supports the pan/zoom button functionality. - For polar axes, this is slightly misleading. Both panning and + For a polar Axes, this is slightly misleading. Both panning and zooming are performed by the same button. Panning is performed in azimuth while zooming is done along the radial. """ diff --git a/lib/matplotlib/tri/_tricontour.py b/lib/matplotlib/tri/_tricontour.py index 7d128ce0a496..c403ebae70d1 100644 --- a/lib/matplotlib/tri/_tricontour.py +++ b/lib/matplotlib/tri/_tricontour.py @@ -252,7 +252,7 @@ def tricontourf(ax, *args, **kwargs): %(_tricontour_doc)s hatches : list[str], optional - A list of cross hatch patterns to use on the filled areas. + A list of crosshatch patterns to use on the filled areas. If None, no hatching will be added to the contour. Hatching is supported in the PostScript, PDF, SVG and Agg backends only. diff --git a/lib/matplotlib/tri/_triinterpolate.py b/lib/matplotlib/tri/_triinterpolate.py index a4d294ad1719..df276d8c6447 100644 --- a/lib/matplotlib/tri/_triinterpolate.py +++ b/lib/matplotlib/tri/_triinterpolate.py @@ -125,7 +125,7 @@ def _interpolate_multikeys(self, x, y, tri_index=None, (Note that np.vectorize could do most of those things very well for you, but it does it by function evaluations over successive tuples of - the input arrays. Therefore, this tends to be more time consuming than + the input arrays. Therefore, this tends to be more time-consuming than using optimized numpy functions - e.g., np.dot - which can be used easily on the flattened inputs, in the child-subclass methods :meth:`_interpolate_single_key`.) diff --git a/lib/matplotlib/tri/_trirefine.py b/lib/matplotlib/tri/_trirefine.py index 80e41458d4fe..a0a57935fb99 100644 --- a/lib/matplotlib/tri/_trirefine.py +++ b/lib/matplotlib/tri/_trirefine.py @@ -63,7 +63,7 @@ def __init__(self, triangulation): def refine_triangulation(self, return_tri_index=False, subdiv=3): """ - Compute an uniformly refined triangulation *refi_triangulation* of + Compute a uniformly refined triangulation *refi_triangulation* of the encapsulated :attr:`triangulation`. This function refines the encapsulated triangulation by splitting each diff --git a/lib/matplotlib/tri/_tritools.py b/lib/matplotlib/tri/_tritools.py index 11b500fcdd8f..9837309f7e81 100644 --- a/lib/matplotlib/tri/_tritools.py +++ b/lib/matplotlib/tri/_tritools.py @@ -128,7 +128,7 @@ def get_flat_tri_mask(self, min_circle_ratio=0.01, rescale=True): The *new_mask* array is computed recursively; at each step flat triangles are removed only if they share a side with the current mesh - border. Thus no new holes in the triangulated domain will be created. + border. Thus, no new holes in the triangulated domain will be created. Parameters ----------