diff --git a/lib/matplotlib/offsetbox.py b/lib/matplotlib/offsetbox.py index 99adfee2e95e..0744190f19c0 100644 --- a/lib/matplotlib/offsetbox.py +++ b/lib/matplotlib/offsetbox.py @@ -511,7 +511,7 @@ def __init__(self, child, pad=None, draw_frame=False, patch_attrs=None): The contained `.Artist`. pad : float The padding in points. This will be scaled with the renderer dpi. - In contrast *width* and *height* are in *pixels* and thus not + In contrast, *width* and *height* are in *pixels* and thus not scaled. draw_frame : bool Whether to draw the contained `.FancyBboxPatch`. @@ -945,7 +945,7 @@ def __init__(self, loc, The box location. Valid locations are 'upper left', 'upper center', 'upper right', 'center left', 'center', 'center right', - 'lower left', 'lower center, 'lower right'. + 'lower left', 'lower center', 'lower right'. For backward compatibility, numeric values are accepted as well. See the parameter *loc* of `.Legend` for details. pad : float, default: 0.4 diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py index f61524f65597..e8c126664248 100644 --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -101,7 +101,7 @@ def get_verts(self): """ Return a copy of the vertices used in this patch. - If the patch contains Bezier curves, the curves will be interpolated by + If the patch contains Bézier curves, the curves will be interpolated by line segments. To access the curves as curves, use `get_path`. """ trans = self.get_transform() @@ -164,7 +164,7 @@ def contains_point(self, point, radius=None): ``self.get_transform()``. These are display coordinates for patches that are added to a figure or axes. radius : float, optional - Add an additional margin on the patch in target coordinates of + Additional margin on the patch in target coordinates of ``self.get_transform()``. See `.Path.contains_point` for further details. @@ -214,7 +214,7 @@ def contains_points(self, points, radius=None): ``self.get_transform()``. These are display coordinates for patches that are added to a figure or axes. Columns contain x and y values. radius : float, optional - Add an additional margin on the patch in target coordinates of + Additional margin on the patch in target coordinates of ``self.get_transform()``. See `.Path.contains_point` for further details. @@ -941,7 +941,7 @@ def __str__(self): @_docstring.dedent_interpd def __init__(self, path, **kwargs): """ - *path* is a `~.path.Path` object. + *path* is a `.Path` object. Valid keyword arguments are: @@ -961,7 +961,7 @@ class StepPatch(PathPatch): """ A path patch describing a stepwise constant function. - By default the path is not closed and starts and stops at + By default, the path is not closed and starts and stops at baseline value. """ @@ -1137,7 +1137,7 @@ def set_xy(self, xy): Notes ----- - Unlike `~.path.Path`, we do not ignore the last input vertex. If the + Unlike `.Path`, we do not ignore the last input vertex. If the polygon is meant to be closed, and the last point of the polygon is not equal to the first, we assume that the user has not explicitly passed a ``CLOSEPOLY`` vertex, and add it ourselves. @@ -1942,8 +1942,7 @@ def __init__(self, xy, width, height, angle=0.0, ---------------- **kwargs : `.Patch` properties Most `.Patch` properties are supported as keyword arguments, - with the exception of *fill* and *facecolor* because filling is - not supported. + except *fill* and *facecolor* because filling is not supported. %(Patch:kwdoc)s """ @@ -2670,7 +2669,7 @@ class ConnectionStyle(_Style): %(ConnectionStyle:table)s - An instance of any connection style class is an callable object, + An instance of any connection style class is a callable object, whose call signature is:: __call__(self, posA, posB, @@ -2771,7 +2770,7 @@ def __call__(self, posA, posB, @_register_style(_style_list) class Arc3(_Base): """ - Creates a simple quadratic Bezier curve between two + Creates a simple quadratic Bézier curve between two points. The curve is created so that the middle control point (C1) is located at the same distance from the start (C0) and end points(C2) and the distance of the C1 to the line @@ -2780,8 +2779,10 @@ class Arc3(_Base): def __init__(self, rad=0.): """ - *rad* - curvature of the curve. + Parameters + ---------- + rad : float + Curvature of the curve. """ self.rad = rad @@ -2807,19 +2808,21 @@ def connect(self, posA, posB): @_register_style(_style_list) class Angle3(_Base): """ - Creates a simple quadratic Bezier curve between two - points. The middle control points is placed at the - intersecting point of two lines which cross the start and - end point, and have a slope of angleA and angleB, respectively. + Creates a simple quadratic Bézier curve between two points. The middle + control point is placed at the intersecting point of two lines which + cross the start and end point, and have a slope of *angleA* and + *angleB*, respectively. """ def __init__(self, angleA=90, angleB=0): """ - *angleA* - starting angle of the path + Parameters + ---------- + angleA : float + Starting angle of the path. - *angleB* - ending angle of the path + angleB : float + Ending angle of the path. """ self.angleA = angleA @@ -2845,23 +2848,25 @@ def connect(self, posA, posB): @_register_style(_style_list) class Angle(_Base): """ - Creates a piecewise continuous quadratic Bezier path between - two points. The path has a one passing-through point placed at - the intersecting point of two lines which cross the start - and end point, and have a slope of angleA and angleB, respectively. + Creates a piecewise continuous quadratic Bézier path between two + points. The path has a one passing-through point placed at the + intersecting point of two lines which cross the start and end point, + and have a slope of *angleA* and *angleB*, respectively. The connecting edges are rounded with *rad*. """ def __init__(self, angleA=90, angleB=0, rad=0.): """ - *angleA* - starting angle of the path + Parameters + ---------- + angleA : float + Starting angle of the path. - *angleB* - ending angle of the path + angleB : float + Ending angle of the path. - *rad* - rounding radius of the edge + rad : float + Rounding radius of the edge. """ self.angleA = angleA @@ -2907,29 +2912,31 @@ def connect(self, posA, posB): @_register_style(_style_list) class Arc(_Base): """ - Creates a piecewise continuous quadratic Bezier path between - two points. The path can have two passing-through points, a - point placed at the distance of armA and angle of angleA from + Creates a piecewise continuous quadratic Bézier path between two + points. The path can have two passing-through points, a + point placed at the distance of *armA* and angle of *angleA* from point A, another point with respect to point B. The edges are rounded with *rad*. """ def __init__(self, angleA=0, angleB=0, armA=None, armB=None, rad=0.): """ - *angleA* : - starting angle of the path + Parameters + ---------- + angleA : float + Starting angle of the path. - *angleB* : - ending angle of the path + angleB : float + Ending angle of the path. - *armA* : - length of the starting arm + armA : float or None + Length of the starting arm. - *armB* : - length of the ending arm + armB : float or None + Length of the ending arm. - *rad* : - rounding radius of the edges + rad : float + Rounding radius of the edges. """ self.angleA = angleA @@ -3001,10 +3008,10 @@ def connect(self, posA, posB): @_register_style(_style_list) class Bar(_Base): """ - A line with *angle* between A and B with *armA* and - *armB*. One of the arms is extended so that they are connected in - a right angle. The length of armA is determined by (*armA* - + *fraction* x AB distance). Same for armB. + A line with *angle* between A and B with *armA* and *armB*. One of the + arms is extended so that they are connected in a right angle. The + length of *armA* is determined by (*armA* + *fraction* x AB distance). + Same for *armB*. """ def __init__(self, armA=0., armB=0., fraction=0.3, angle=None): @@ -3012,18 +3019,17 @@ def __init__(self, armA=0., armB=0., fraction=0.3, angle=None): Parameters ---------- armA : float - minimum length of armA + Minimum length of armA. armB : float - minimum length of armB + Minimum length of armB. fraction : float - a fraction of the distance between two points that - will be added to armA and armB. + A fraction of the distance between two points that will be + added to armA and armB. angle : float or None - angle of the connecting line (if None, parallel - to A and B) + Angle of the connecting line (if None, parallel to A and B). """ self.armA = armA self.armB = armB @@ -3091,7 +3097,7 @@ class ArrowStyle(_Style): arrowstyle classes, which is used to create an arrow path along a given path. These are mainly used with `FancyArrowPatch`. - A arrowstyle object can be either created as:: + An arrowstyle object can be either created as:: ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4) @@ -3151,9 +3157,9 @@ class is not an artist and actual drawing of the fancy arrow is def ensure_quadratic_bezier(path): """ Some ArrowStyle classes only works with a simple quadratic - Bezier curve (created with `.ConnectionStyle.Arc3` or + Bézier curve (created with `.ConnectionStyle.Arc3` or `.ConnectionStyle.Angle3`). This static method checks if the - provided path is a simple quadratic Bezier curve and returns its + provided path is a simple quadratic Bézier curve and returns its control points if true. """ segments = list(path.iter_segments()) @@ -3166,14 +3172,14 @@ def ensure_quadratic_bezier(path): def transmute(self, path, mutation_size, linewidth): """ The transmute method is the very core of the ArrowStyle class and - must be overridden in the subclasses. It receives the path object - along which the arrow will be drawn, and the mutation_size, with - which the arrow head etc. will be scaled. The linewidth may be - used to adjust the path so that it does not pass beyond the given - points. It returns a tuple of a Path instance and a boolean. The - boolean value indicate whether the path can be filled or not. The - return value can also be a list of paths and list of booleans of a - same length. + must be overridden in the subclasses. It receives the *path* + object along which the arrow will be drawn, and the + *mutation_size*, with which the arrow head etc. will be scaled. + The *linewidth* may be used to adjust the path so that it does not + pass beyond the given points. It returns a tuple of a `.Path` + instance and a boolean. The boolean value indicate whether the + path can be filled or not. The return value can also be a list of + paths and list of booleans of the same length. """ raise NotImplementedError('Derived must override') @@ -3206,7 +3212,7 @@ class _Curve(_Base): """ A simple arrow which will work with any path instance. The returned path is the concatenation of the original path, and at - most two paths representing the arrow head or bracket at the begin + most two paths representing the arrow head or bracket at the start point and at the end point. The arrow heads can be either open or closed. """ @@ -3381,7 +3387,7 @@ def _get_bracket(self, x0, y0, return vertices_arrow, codes_arrow def transmute(self, path, mutation_size, linewidth): - + # Doc-string inherited if self._beginarrow_head or self._endarrow_head: head_length = self.head_length * mutation_size head_width = self.head_width * mutation_size @@ -3480,7 +3486,7 @@ def __init__(self): # hide head_length, head_width @_register_style(_style_list, name="<-") class CurveA(_Curve): - """An arrow with a head at its begin point.""" + """An arrow with a head at its start point.""" arrow = "<-" @_register_style(_style_list, name="->") @@ -3490,12 +3496,12 @@ class CurveB(_Curve): @_register_style(_style_list, name="<->") class CurveAB(_Curve): - """An arrow with heads both at the begin and the end point.""" + """An arrow with heads both at the start and the end point.""" arrow = "<->" @_register_style(_style_list, name="<|-") class CurveFilledA(_Curve): - """An arrow with filled triangle head at the begin.""" + """An arrow with filled triangle head at the start.""" arrow = "<|-" @_register_style(_style_list, name="-|>") @@ -3632,7 +3638,7 @@ def __init__(self, widthB=1., lengthB=0.2, angleB=None): @_register_style(_style_list) class Simple(_Base): - """A simple arrow. Only works with a quadratic Bezier curve.""" + """A simple arrow. Only works with a quadratic Bézier curve.""" def __init__(self, head_length=.5, head_width=.5, tail_width=.2): """ @@ -3652,7 +3658,7 @@ def __init__(self, head_length=.5, head_width=.5, tail_width=.2): super().__init__() def transmute(self, path, mutation_size, linewidth): - + # Doc-string inherited x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path) # divide the path into a head and a tail @@ -3712,7 +3718,7 @@ def transmute(self, path, mutation_size, linewidth): @_register_style(_style_list) class Fancy(_Base): - """A fancy arrow. Only works with a quadratic Bezier curve.""" + """A fancy arrow. Only works with a quadratic Bézier curve.""" def __init__(self, head_length=.4, head_width=.4, tail_width=.4): """ @@ -3732,7 +3738,7 @@ def __init__(self, head_length=.4, head_width=.4, tail_width=.4): super().__init__() def transmute(self, path, mutation_size, linewidth): - + # Doc-string inherited x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path) # divide the path into a head and a tail @@ -3801,9 +3807,9 @@ def transmute(self, path, mutation_size, linewidth): @_register_style(_style_list) class Wedge(_Base): """ - Wedge(?) shape. Only works with a quadratic Bezier curve. The - begin point has a width of the tail_width and the end point has a - width of 0. At the middle, the width is shrink_factor*tail_width. + Wedge(?) shape. Only works with a quadratic Bézier curve. The + start point has a width of the *tail_width* and the end point has a + width of 0. At the middle, the width is *shrink_factor*x*tail_width*. """ def __init__(self, tail_width=.3, shrink_factor=0.5): @@ -3821,7 +3827,7 @@ def __init__(self, tail_width=.3, shrink_factor=0.5): super().__init__() def transmute(self, path, mutation_size, linewidth): - + # Doc-string inherited x0, y0, x1, y1, x2, y2 = self.ensure_quadratic_bezier(path) arrow_path = [(x0, y0), (x1, y1), (x2, y2)] @@ -4250,7 +4256,7 @@ def __init__(self, posA=None, posB=None, path=None, def set_positions(self, posA, posB): """ - Set the begin and end positions of the connecting path. + Set the start and end positions of the connecting path. Parameters ---------- diff --git a/lib/matplotlib/path.py b/lib/matplotlib/path.py index 75566cdddcb1..a017ed742970 100644 --- a/lib/matplotlib/path.py +++ b/lib/matplotlib/path.py @@ -48,11 +48,11 @@ class Path: Draw a line from the current position to the given vertex. - ``CURVE3`` : 1 control point, 1 endpoint - Draw a quadratic Bezier curve from the current position, with the given + Draw a quadratic Bézier curve from the current position, with the given control point, to the given end point. - ``CURVE4`` : 2 control points, 1 endpoint - Draw a cubic Bezier curve from the current position, with the given + Draw a cubic Bézier curve from the current position, with the given control points, to the given end point. - ``CLOSEPOLY`` : 1 vertex (ignored) @@ -419,7 +419,7 @@ def iter_segments(self, transform=None, remove_nans=True, clip=None, def iter_bezier(self, **kwargs): """ - Iterate over each bezier curve (lines included) in a Path. + Iterate over each Bézier curve (lines included) in a Path. Parameters ---------- @@ -429,13 +429,13 @@ def iter_bezier(self, **kwargs): Yields ------ B : matplotlib.bezier.BezierSegment - The bezier curves that make up the current path. Note in particular - that freestanding points are bezier curves of order 0, and lines - are bezier curves of order 1 (with two control points). + The Bézier curves that make up the current path. Note in particular + that freestanding points are Bézier curves of order 0, and lines + are Bézier curves of order 1 (with two control points). code : Path.code_type The code describing what kind of curve is being returned. Path.MOVETO, Path.LINETO, Path.CURVE3, Path.CURVE4 correspond to - bezier curves with 1, 2, 3, and 4 control points (respectively). + Bézier curves with 1, 2, 3, and 4 control points (respectively). Path.CLOSEPOLY is a Path.LINETO with the control points correctly chosen based on the start/end points of the current stroke. """ @@ -513,7 +513,7 @@ def contains_point(self, point, transform=None, radius=0.0): by *transform*; i.e. for a correct check, *transform* should transform the path into the coordinate system of *point*. radius : float, default: 0 - Add an additional margin on the path in coordinates of *point*. + Additional margin on the path in coordinates of *point*. The path is extended tangentially by *radius/2*; i.e. if you would draw the path with a linewidth of *radius*, all points on the line would still be considered to be contained in the area. Conversely, @@ -563,7 +563,7 @@ def contains_points(self, points, transform=None, radius=0.0): by *transform*; i.e. for a correct check, *transform* should transform the path into the coordinate system of *points*. radius : float, default: 0 - Add an additional margin on the path in coordinates of *points*. + Additional margin on the path in coordinates of *points*. The path is extended tangentially by *radius/2*; i.e. if you would draw the path with a linewidth of *radius*, all points on the line would still be considered to be contained in the area. Conversely, @@ -688,7 +688,7 @@ def to_polygons(self, transform=None, width=0, height=0, closed_only=True): polygon/polyline is an Nx2 array of vertices. In other words, each polygon has no ``MOVETO`` instructions or curves. This is useful for displaying in backends that do not support - compound paths or Bezier curves. + compound paths or Bézier curves. If *width* and *height* are both non-zero then the lines will be simplified so that vertices outside of (0, 0), (width, @@ -827,7 +827,7 @@ def circle(cls, center=(0., 0.), radius=1., readonly=False): Notes ----- - The circle is approximated using 8 cubic Bezier curves, as described in + The circle is approximated using 8 cubic Bézier curves, as described in Lancaster, Don. `Approximating a Circle or an Ellipse Using Four Bezier Cubic Splines `_. diff --git a/lib/matplotlib/sankey.py b/lib/matplotlib/sankey.py index 290c67830e14..4f52e39ad3e6 100644 --- a/lib/matplotlib/sankey.py +++ b/lib/matplotlib/sankey.py @@ -371,7 +371,7 @@ def add(self, patchlabel='', flows=None, orientations=None, labels='', the outside in. If the sum of the inputs and outputs is - nonzero, the discrepancy will appear as a cubic Bezier curve along + nonzero, the discrepancy will appear as a cubic Bézier curve along the top and bottom edges of the trunk. orientations : list of {-1, 0, 1} diff --git a/lib/matplotlib/spines.py b/lib/matplotlib/spines.py index 44b136d02f3f..5337797ec486 100644 --- a/lib/matplotlib/spines.py +++ b/lib/matplotlib/spines.py @@ -23,7 +23,7 @@ class Spine(mpatches.Patch): Spines are subclasses of `.Patch`, and inherit much of their behavior. - Spines draw a line, a circle, or an arc depending if + Spines draw a line, a circle, or an arc depending on if `~.Spine.set_patch_line`, `~.Spine.set_patch_circle`, or `~.Spine.set_patch_arc` has been called. Line-like is the default. @@ -516,7 +516,7 @@ class Spines(MutableMapping): The container of all `.Spine`\s in an Axes. The interface is dict-like mapping names (e.g. 'left') to `.Spine` objects. - Additionally it implements some pandas.Series-like features like accessing + Additionally, it implements some pandas.Series-like features like accessing elements by attribute:: spines['top'].set_visible(False) diff --git a/lib/matplotlib/streamplot.py b/lib/matplotlib/streamplot.py index 78d1c7d1e91a..99997a0c75b8 100644 --- a/lib/matplotlib/streamplot.py +++ b/lib/matplotlib/streamplot.py @@ -39,7 +39,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, For different densities in each direction, use a tuple (density_x, density_y). linewidth : float or 2D array - The width of the stream lines. With a 2D array the line width can be + The width of the streamlines. With a 2D array the line width can be varied across the grid. The array must have the same shape as *u* and *v*. color : color or 2D array @@ -61,7 +61,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, Coordinates of starting points for the streamlines in data coordinates (the same coordinates as the *x* and *y* arrays). zorder : int - The zorder of the stream lines and arrows. + The zorder of the streamlines and arrows. Artists with lower zorder values are drawn first. maxlength : float Maximum length of streamline in axes coordinates. @@ -82,7 +82,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, - ``lines``: `.LineCollection` of streamlines - ``arrows``: `.PatchCollection` containing `.FancyArrowPatch` - objects representing the arrows half-way along stream lines. + objects representing the arrows half-way along streamlines. This container will probably change in the future to allow changes to the colormap, alpha, etc. for both lines and arrows, but these @@ -201,7 +201,7 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None, points = np.transpose([tx, ty]).reshape(-1, 1, 2) streamlines.extend(np.hstack([points[:-1], points[1:]])) - # Add arrows half way along each trajectory. + # Add arrows halfway along each trajectory. s = np.cumsum(np.hypot(np.diff(tx), np.diff(ty))) n = np.searchsorted(s, s[-1] / 2.) arrow_tail = (tx[n], ty[n]) diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py index ccf6ce879b2a..a10e260932c3 100644 --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1005,7 +1005,7 @@ def set_linespacing(self, spacing): def set_fontfamily(self, fontname): """ - Set the font family. May be either a single string, or a list of + Set the font family. Can be either a single string, or a list of strings in decreasing priority. Each string may be either a real font name or a generic font class name. If the latter, the specific font names will be looked up in the corresponding rcParams. @@ -1065,7 +1065,7 @@ def set_fontsize(self, fontsize): ---------- fontsize : float or {'xx-small', 'x-small', 'small', 'medium', \ 'large', 'x-large', 'xx-large'} - If float, the fontsize in points. The string values denote sizes + If a float, the fontsize in points. The string values denote sizes relative to the default font size. See Also @@ -1779,8 +1779,8 @@ def transform(renderer) -> Transform *relpos*. It's a tuple of relative coordinates of the text box, where (0, 0) is the lower left corner and (1, 1) is the upper right corner. Values <0 and >1 are supported and specify points - outside the text box. By default (0.5, 0.5) the starting point is - centered in the text box. + outside the text box. By default (0.5, 0.5), so the starting point + is centered in the text box. annotation_clip : bool or None, default: None Whether to clip (i.e. not draw) the annotation when the annotation diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 6646ea1ede13..fbfe0eaab207 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -55,7 +55,7 @@ view limits from the data limits. If you want to override the default locator, use one of the above or a custom -locator and pass it to the x or y axis instance. The relevant methods are:: +locator and pass it to the x- or y-axis instance. The relevant methods are:: ax.xaxis.set_major_locator(xmajor_locator) ax.xaxis.set_minor_locator(xminor_locator) @@ -758,7 +758,7 @@ def _compute_offset(self): def _set_order_of_magnitude(self): # if scientific notation is to be used, find the appropriate exponent - # if using an numerical offset, find the exponent after applying the + # if using a numerical offset, find the exponent after applying the # offset. When lower power limit = upper <> 0, use provided exponent. if not self._scientific: self.orderOfMagnitude = 0 diff --git a/lib/matplotlib/transforms.py b/lib/matplotlib/transforms.py index 1471d4fe672d..9a07a18c5dd1 100644 --- a/lib/matplotlib/transforms.py +++ b/lib/matplotlib/transforms.py @@ -17,7 +17,7 @@ .. image:: ../_static/transforms.png The framework can be used for both affine and non-affine -transformations. However, for speed, we want use the backend +transformations. However, for speed, we want to use the backend renderers to perform affine transformations whenever possible. Therefore, it is possible to perform just the affine or non-affine part of a transformation on a set of data. The affine is always diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py index 004ceea2a733..cb168d363f15 100644 --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -973,7 +973,7 @@ class CheckButtons(AxesWidget): rectangles : list of `.Rectangle` lines : list of (`.Line2D`, `.Line2D`) pairs - List of lines for the x's in the check boxes. These lines exist for + List of lines for the x's in the checkboxes. These lines exist for each box, but have ``set_visible(False)`` when its box is not checked. """ @@ -2684,8 +2684,8 @@ def direction(self): def set_data(self, positions): """ - Set x or y positions of handles, depending if the lines are vertical - of horizontal. + Set x- or y-positions of handles, depending on if the lines are + vertical or horizontal. Parameters ----------