Thanks to visit codestin.com
Credit goes to github.com

Skip to content

DOC: improve grammar and consistency #24517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/matplotlib/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def remove(self):
Note: there is no support for removing the artist's legend entry.
"""

# There is no method to set the callback. Instead the parent should
# There is no method to set the callback. Instead, the parent should
# set the _remove_method attribute directly. This would be a
# protected attribute if Python supported that sort of thing. The
# callback has one parameter, which is the child to be removed.
Expand Down Expand Up @@ -521,7 +521,7 @@ def pick(self, mouseevent):
# tick label) can be outside the bounding box of the
# Axes and inaxes will be None
# also check that ax is None so that it traverse objects
# which do no have an axes property but children might
# which do not have an axes property but children might
a.pick(mouseevent)

def set_picker(self, picker):
Expand Down Expand Up @@ -878,7 +878,7 @@ def set_clip_on(self, b):
"""
Set whether the artist uses clipping.

When False artists will be visible outside of the Axes which
When False, artists will be visible outside the Axes which
can lead to unexpected results.

Parameters
Expand Down Expand Up @@ -1145,7 +1145,7 @@ def _update_props(self, props, errfmt):
Helper for `.Artist.set` and `.Artist.update`.

*errfmt* is used to generate error messages for invalid property
names; it get formatted with ``type(self)`` and the property name.
names; it gets formatted with ``type(self)`` and the property name.
"""
ret = []
with cbook._setattr_cm(self, eventson=False):
Expand Down Expand Up @@ -1371,7 +1371,7 @@ def set_mouseover(self, mouseover):
def _get_tightbbox_for_layout_only(obj, *args, **kwargs):
"""
Matplotlib's `.Axes.get_tightbbox` and `.Axis.get_tightbbox` support a
*for_layout_only* kwarg; this helper tries to uses the kwarg but skips it
*for_layout_only* kwarg; this helper tries to use the kwarg but skips it
when encountering third-party subclasses that do not support it.
"""
try:
Expand Down Expand Up @@ -1463,7 +1463,7 @@ def get_valid_values(self, attr):
# although barely relevant wrt. matplotlib's total import time.
param_name = func.__code__.co_varnames[1]
# We could set the presence * based on whether the parameter is a
# varargs (it can't be a varkwargs) but it's not really worth the it.
# varargs (it can't be a varkwargs) but it's not really worth it.
match = re.search(r"(?m)^ *\*?{} : (.+)".format(param_name), docstring)
if match:
return match.group(1)
Expand Down Expand Up @@ -1523,7 +1523,7 @@ def aliased_name(self, s):
"""
Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME'.

e.g., for the line markerfacecolor property, which has an
For example, for the line markerfacecolor property, which has an
alias, return 'markerfacecolor or mfc' and for the transform
property, which does not, return 'transform'.
"""
Expand Down Expand Up @@ -1551,7 +1551,7 @@ def aliased_name_rest(self, s, target):
Return 'PROPNAME or alias' if *s* has an alias, else return 'PROPNAME',
formatted for reST.

e.g., for the line markerfacecolor property, which has an
For example, for the line markerfacecolor property, which has an
alias, return 'markerfacecolor or mfc' and for the transform
property, which does not, return 'transform'.
"""
Expand Down
16 changes: 8 additions & 8 deletions lib/matplotlib/axis.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Classes for the ticks and x and y axis.
Classes for the ticks and x- and y-axis.
"""

import datetime
Expand Down Expand Up @@ -278,13 +278,13 @@ def _get_text2(self):
"""Get the default Text 2 instance."""

def _get_tick1line(self):
"""Get the default line2D instance for tick1."""
"""Get the default `.Line2D` instance for tick1."""

def _get_tick2line(self):
"""Get the default line2D instance for tick2."""
"""Get the default `.Line2D` instance for tick2."""

def _get_gridline(self):
"""Get the default grid Line2d instance for this tick."""
"""Get the default grid `.Line2D` instance for this tick."""

def get_loc(self):
"""Return the tick location (data coords) as a scalar."""
Expand Down Expand Up @@ -796,7 +796,7 @@ def _set_axes_scale(self, value, **kwargs):

Notes
-----
By default, Matplotlib supports the above mentioned scales.
By default, Matplotlib supports the above-mentioned scales.
Additionally, custom scales may be registered using
`matplotlib.scale.register_scale`. These scales can then also
be used here.
Expand Down Expand Up @@ -1591,7 +1591,7 @@ def grid(self, visible=None, which='major', **kwargs):
def update_units(self, data):
"""
Introspect *data* for units converter and update the
axis.converter instance if necessary. Return *True*
``axis.converter`` instance if necessary. Return *True*
if *data* is registered for unit conversion.
"""
converter = munits.registry.get_converter(data)
Expand Down Expand Up @@ -2034,7 +2034,7 @@ def _get_tick_boxes_siblings(self, renderer):
Get the bounding boxes for this `.axis` and its siblings
as set by `.Figure.align_xlabels` or `.Figure.align_ylabels`.

By default it just gets bboxes for self.
By default, it just gets bboxes for *self*.
"""
# Get the Grouper keeping track of x or y label groups for this figure.
axis_names = [
Expand Down Expand Up @@ -2213,7 +2213,7 @@ def _init(self):
self.offset_text_position = 'bottom'

def contains(self, mouseevent):
"""Test whether the mouse event occurred in the x axis."""
"""Test whether the mouse event occurred in the x-axis."""
inside, info = self._default_contains(mouseevent)
if inside is not None:
return inside, info
Expand Down
40 changes: 20 additions & 20 deletions lib/matplotlib/bezier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
A module providing some utility functions regarding Bezier path manipulation.
A module providing some utility functions regarding Bézier path manipulation.
"""

from functools import lru_cache
Expand Down Expand Up @@ -94,7 +94,7 @@ def _de_casteljau1(beta, t):

def split_de_casteljau(beta, t):
"""
Split a Bezier segment defined by its control points *beta* into two
Split a Bézier segment defined by its control points *beta* into two
separate segments divided at *t* and return their control points.
"""
beta = np.asarray(beta)
Expand All @@ -113,7 +113,7 @@ def split_de_casteljau(beta, t):
def find_bezier_t_intersecting_with_closedpath(
bezier_point_at_t, inside_closedpath, t0=0., t1=1., tolerance=0.01):
"""
Find the intersection of the Bezier curve with a closed path.
Find the intersection of the Bézier curve with a closed path.

The intersection point *t* is approximated by two parameters *t0*, *t1*
such that *t0* <= *t* <= *t1*.
Expand All @@ -126,7 +126,7 @@ def find_bezier_t_intersecting_with_closedpath(
Parameters
----------
bezier_point_at_t : callable
A function returning x, y coordinates of the Bezier at parameter *t*.
A function returning x, y coordinates of the Bézier at parameter *t*.
It must have the signature::

bezier_point_at_t(t: float) -> tuple[float, float]
Expand All @@ -146,7 +146,7 @@ def find_bezier_t_intersecting_with_closedpath(
Returns
-------
t0, t1 : float
The Bezier path parameters.
The Bézier path parameters.
"""
start = bezier_point_at_t(t0)
end = bezier_point_at_t(t1)
Expand Down Expand Up @@ -180,7 +180,7 @@ def find_bezier_t_intersecting_with_closedpath(

class BezierSegment:
"""
A d-dimensional Bezier segment.
A d-dimensional Bézier segment.

Parameters
----------
Expand All @@ -199,7 +199,7 @@ def __init__(self, control_points):

def __call__(self, t):
"""
Evaluate the Bezier curve at point(s) t in [0, 1].
Evaluate the Bézier curve at point(s) *t* in [0, 1].

Parameters
----------
Expand Down Expand Up @@ -239,15 +239,15 @@ def degree(self):
@property
def polynomial_coefficients(self):
r"""
The polynomial coefficients of the Bezier curve.
The polynomial coefficients of the Bézier curve.

.. warning:: Follows opposite convention from `numpy.polyval`.

Returns
-------
(n+1, d) array
Coefficients after expanding in polynomial basis, where :math:`n`
is the degree of the bezier curve and :math:`d` its dimension.
is the degree of the Bézier curve and :math:`d` its dimension.
These are the numbers (:math:`C_j`) such that the curve can be
written :math:`\sum_{j=0}^n C_j t^j`.

Expand Down Expand Up @@ -308,12 +308,12 @@ def axis_aligned_extrema(self):
def split_bezier_intersecting_with_closedpath(
bezier, inside_closedpath, tolerance=0.01):
"""
Split a Bezier curve into two at the intersection with a closed path.
Split a Bézier curve into two at the intersection with a closed path.

Parameters
----------
bezier : (N, 2) array-like
Control points of the Bezier segment. See `.BezierSegment`.
Control points of the Bézier segment. See `.BezierSegment`.
inside_closedpath : callable
A function returning True if a given point (x, y) is inside the
closed path. See also `.find_bezier_t_intersecting_with_closedpath`.
Expand All @@ -324,7 +324,7 @@ def split_bezier_intersecting_with_closedpath(
Returns
-------
left, right
Lists of control points for the two Bezier segments.
Lists of control points for the two Bézier segments.
"""

bz = BezierSegment(bezier)
Expand Down Expand Up @@ -461,13 +461,13 @@ def check_if_parallel(dx1, dy1, dx2, dy2, tolerance=1.e-5):

def get_parallels(bezier2, width):
"""
Given the quadratic Bezier control points *bezier2*, returns
control points of quadratic Bezier lines roughly parallel to given
Given the quadratic Bézier control points *bezier2*, returns
control points of quadratic Bézier lines roughly parallel to given
one separated by *width*.
"""

# The parallel Bezier lines are constructed by following ways.
# c1 and c2 are control points representing the begin and end of the
# c1 and c2 are control points representing the start and end of the
# Bezier line.
# cm is the middle point

Expand All @@ -485,7 +485,7 @@ def get_parallels(bezier2, width):
cos_t2, sin_t2 = cos_t1, sin_t1
else:
# t1 and t2 is the angle between c1 and cm, cm, c2. They are
# also a angle of the tangential line of the path at c1 and c2
# also an angle of the tangential line of the path at c1 and c2
cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c2x, c2y)

Expand Down Expand Up @@ -535,7 +535,7 @@ def get_parallels(bezier2, width):

def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):
"""
Find control points of the Bezier curve passing through (*c1x*, *c1y*),
Find control points of the Bézier curve passing through (*c1x*, *c1y*),
(*mmx*, *mmy*), and (*c2x*, *c2y*), at parametric values 0, 0.5, and 1.
"""
cmx = .5 * (4 * mmx - (c1x + c2x))
Expand All @@ -545,8 +545,8 @@ def find_control_points(c1x, c1y, mmx, mmy, c2x, c2y):

def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
"""
Being similar to get_parallels, returns control points of two quadratic
Bezier lines having a width roughly parallel to given one separated by
Being similar to `get_parallels`, returns control points of two quadratic
Bézier lines having a width roughly parallel to given one separated by
*width*.
"""

Expand All @@ -556,7 +556,7 @@ def make_wedged_bezier2(bezier2, width, w1=1., wm=0.5, w2=0.):
c3x, c3y = bezier2[2]

# t1 and t2 is the angle between c1 and cm, cm, c3.
# They are also a angle of the tangential line of the path at c1 and c3
# They are also an angle of the tangential line of the path at c1 and c3
cos_t1, sin_t1 = get_cos_sin(c1x, c1y, cmx, cmy)
cos_t2, sin_t2 = get_cos_sin(cmx, cmy, c3x, c3y)

Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,7 @@ def set_color(self, c):

Parameters
----------
c : color or list of rgba tuples
c : color or list of RGBA tuples

See Also
--------
Expand Down Expand Up @@ -1468,7 +1468,7 @@ def set_color(self, c):
----------
c : color or list of colors
Single color (all lines have same color), or a
sequence of rgba tuples; if it is a sequence the lines will
sequence of RGBA tuples; if it is a sequence the lines will
cycle through the sequence.
"""
self.set_edgecolor(c)
Expand Down
4 changes: 2 additions & 2 deletions lib/matplotlib/colorbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ def add_lines(self, *args, **kwargs):

def update_ticks(self):
"""
Setup the ticks and ticklabels. This should not be needed by users.
Set up the ticks and ticklabels. This should not be needed by users.
"""
# Get the locator and formatter; defaults to self._locator if not None.
self._get_ticker_locator_formatter()
Expand Down Expand Up @@ -1024,7 +1024,7 @@ def _set_scale(self, scale, **kwargs):

Notes
-----
By default, Matplotlib supports the above mentioned scales.
By default, Matplotlib supports the above-mentioned scales.
Additionally, custom scales may be registered using
`matplotlib.scale.register_scale`. These scales can then also
be used here.
Expand Down
Loading