Bases: matplotlib.patches.Ellipse
An elliptical arc. Because it performs various optimizations, it can not be filled.
The arc must be used in an Axes instance—it can not be added directly to a Figure—because it is optimized to only render the segments that are inside the axes bounding box with high resolution.
The following args are supported:
If theta1 and theta2 are not provided, the arc will form a complete ellipse.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Ellipses are normally drawn using an approximation that uses eight cubic bezier splines. The error of this approximation is 1.89818e-6, according to this unverified source:
Lancaster, Don. Approximating a Circle or an Ellipse Using Four Bezier Cubic Splines.
There is a use case where very large ellipses must be drawn with very high accuracy, and it is too expensive to render the entire ellipse with enough segments (either splines or line segments). Therefore, in the case where either radius of the ellipse is large enough that the error of the spline approximation will be visible (greater than one pixel offset from the ideal), a different technique is used.
In that case, only the visible parts of the ellipse are drawn, with each visible arc using a fixed number of spline segments (8). The algorithm proceeds as follows:
The points where the ellipse intersects the axes bounding box are located. (This is done be performing an inverse transformation on the axes bbox such that it is relative to the unit circle – this makes the intersection calculation much easier than doing rotated ellipse intersection directly).
This uses the “line intersecting a circle” algorithm from:
Vince, John. Geometry for Computer Graphics: Formulae, Examples & Proofs. London: Springer-Verlag, 2005.
The angles of each of the intersection points are calculated.
Proceeding counterclockwise starting in the positive x-direction, each of the visible arc-segments between the pairs of vertices are drawn using the bezier arc approximation technique implemented in matplotlib.path.Path.arc().
Bases: matplotlib.patches.Patch
An arrow patch.
Draws an arrow, starting at (x, y), direction and length given by (dx, dy) the width of the arrow is scaled by width.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Bases: matplotlib.patches._Style
ArrowStyle is a container class which defines several 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:
ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4)
or:
ArrowStyle("Fancy", head_length=.4, head_width=.4, tail_width=.4)
or:
ArrowStyle("Fancy, head_length=.4, head_width=.4, tail_width=.4")
The following classes are defined
Class Name Attrs Curve - None CurveB -> head_length=0.4,head_width=0.2 BracketB -[ widthB=1.0,lengthB=0.2,angleB=None CurveFilledB -|> head_length=0.4,head_width=0.2 CurveA <- head_length=0.4,head_width=0.2 CurveAB <-> head_length=0.4,head_width=0.2 CurveFilledA <|- head_length=0.4,head_width=0.2 CurveFilledAB <|-|> head_length=0.4,head_width=0.2 BracketA ]- widthA=1.0,lengthA=0.2,angleA=None BracketAB ]-[ widthA=1.0,lengthA=0.2,angleA=None,widthB=1.0,lengthB=0.2,angleB=None Fancy fancy head_length=0.4,head_width=0.4,tail_width=0.4 Simple simple head_length=0.5,head_width=0.5,tail_width=0.2 Wedge wedge tail_width=0.3,shrink_factor=0.5 BarAB |-| widthA=1.0,angleA=None,widthB=1.0,angleB=None
An instance of any arrow style class is an callable object, whose call signature is:
__call__(self, path, mutation_size, linewidth, aspect_ratio=1.)
and it returns a tuple of a Path instance and a boolean value. path is a Path instance along witch the arrow will be drawn. mutation_size and aspect_ratio has a same meaning as in BoxStyle. linewidth is a line width to be stroked. This is meant to be used to correct the location of the head so that it does not overshoot the destination point, but not all classes support it.
(Source code, png)
Bases: matplotlib.patches._Bracket
An arrow with a bar(|) at both ends.
Bases: matplotlib.patches._Bracket
An arrow with a bracket(]) at its end.
Bases: matplotlib.patches._Bracket
An arrow with a bracket(]) at both ends.
Bases: matplotlib.patches._Bracket
An arrow with a bracket([) at its end.
Bases: matplotlib.patches._Curve
A simple curve without any arrow head.
Bases: matplotlib.patches._Curve
An arrow with a head at its begin point.
Bases: matplotlib.patches._Curve
An arrow with heads both at the begin and the end point.
Bases: matplotlib.patches._Curve
An arrow with a head at its end point.
Bases: matplotlib.patches._Curve
An arrow with filled triangle head at the begin.
Bases: matplotlib.patches._Curve
An arrow with filled triangle heads both at the begin and the end point.
Bases: matplotlib.patches._Curve
An arrow with filled triangle head at the end.
Bases: matplotlib.patches._Base
A fancy arrow. Only works with a quadratic bezier curve.
Bases: matplotlib.patches._Base
A simple arrow. Only works with a quadratic bezier curve.
Bases: matplotlib.patches._Base
Wedge(?) shape. Only wokrs 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.
Bases: matplotlib.patches._Style
BoxStyle is a container class which defines several boxstyle classes, which are used for FancyBoxPatch.
A style object can be created as:
BoxStyle.Round(pad=0.2)
or:
BoxStyle("Round", pad=0.2)
or:
BoxStyle("Round, pad=0.2")
Following boxstyle classes are defined.
Class Name Attrs Circle circle pad=0.3 DArrow darrow pad=0.3 LArrow larrow pad=0.3 RArrow rarrow pad=0.3 Round round pad=0.3,rounding_size=None Round4 round4 pad=0.3,rounding_size=None Roundtooth roundtooth pad=0.3,tooth_size=None Sawtooth sawtooth pad=0.3,tooth_size=None Square square pad=0.3
An instance of any boxstyle class is an callable object, whose call signature is:
__call__(self, x0, y0, width, height, mutation_size, aspect_ratio=1.)
and returns a Path instance. x0, y0, width and height specify the location and size of the box to be drawn. mutation_scale determines the overall size of the mutation (by which I mean the transformation of the rectangle to the fancy box). mutation_aspect determines the aspect-ratio of the mutation.
(Source code, png)
Bases: matplotlib.patches._Base
A simple circle box.
Parameters: | pad : float
|
---|
Bases: matplotlib.patches._Base
(Double) Arrow Box
Bases: matplotlib.patches._Base
(left) Arrow Box
Bases: matplotlib.patches.LArrow
(right) Arrow Box
Bases: matplotlib.patches._Base
A box with round corners.
Bases: matplotlib.patches._Base
Another box with round edges.
Bases: matplotlib.patches.Sawtooth
A rounded tooth box.
Bases: matplotlib.patches.Ellipse
A circle patch.
Create true circle at center xy = (x, y) with given radius. Unlike CirclePolygon which is a polygonal approximation, this uses Bézier splines and is much closer to a scale-free circle.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
return the radius of the circle
return the radius of the circle
Set the radius of the circle
ACCEPTS: float
Bases: matplotlib.patches.RegularPolygon
A polygon-approximation of a circle patch.
Create a circle at xy = (x, y) with given radius. This circle is approximated by a regular polygon with resolution sides. For a smoother circle drawn with splines, see Circle.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Bases: matplotlib.patches.FancyArrowPatch
A ConnectionPatch class is to make connecting lines between two points (possibly in different axes).
Connect point xyA in coordsA with point xyB in coordsB
Valid keys are
Key | Description |
---|---|
arrowstyle | the arrow style |
connectionstyle | the connection style |
relpos | default is (0.5, 0.5) |
patchA | default is bounding box of the text |
patchB | default is None |
shrinkA | default is 2 points |
shrinkB | default is 2 points |
mutation_scale | default is text size (in points) |
mutation_aspect | default is 1. |
? | any key for matplotlib.patches.PathPatch |
coordsA and coordsB are strings that indicate the coordinates of xyA and xyB.
Property | Description |
---|---|
‘figure points’ | points from the lower left corner of the figure |
‘figure pixels’ | pixels from the lower left corner of the figure |
‘figure fraction’ | 0,0 is lower left of figure and 1,1 is upper, right |
‘axes points’ | points from lower left corner of axes |
‘axes pixels’ | pixels from lower left corner of axes |
‘axes fraction’ | 0,1 is lower left of axes and 1,1 is upper right |
‘data’ | use the coordinate system of the object being annotated (default) |
‘offset points’ | Specify an offset (in points) from the xy value |
‘polar’ | you can specify theta, r for the annotation, even in cartesian plots. Note that if you are using a polar axes, you do not need to specify polar for the coordinate system since that is the native “data” coordinate system. |
Draw.
Return annotation_clip attribute. See set_annotation_clip() for the meaning of return values.
Return the mutated path of the arrow in the display coord
set annotation_clip attribute.
- True: the annotation will only be drawn when self.xy is inside the
axes.
- False: the annotation will always be drawn regardless of its
position.
None: the self.xy will be checked only if xycoords is “data”
Bases: matplotlib.patches._Style
ConnectionStyle is a container class which defines several connectionstyle classes, which is used to create a path between two points. These are mainly used with FancyArrowPatch.
A connectionstyle object can be either created as:
ConnectionStyle.Arc3(rad=0.2)
or:
ConnectionStyle("Arc3", rad=0.2)
or:
ConnectionStyle("Arc3, rad=0.2")
The following classes are defined
Class Name Attrs Angle angle angleA=90,angleB=0,rad=0.0 Angle3 angle3 angleA=90,angleB=0 Arc arc angleA=0,angleB=0,armA=None,armB=None,rad=0.0 Arc3 arc3 rad=0.0 Bar bar armA=0.0,armB=0.0,fraction=0.3,angle=None
An instance of any connection style class is an callable object, whose call signature is:
__call__(self, posA, posB,
patchA=None, patchB=None,
shrinkA=2., shrinkB=2.)
and it returns a Path instance. posA and posB are tuples of x,y coordinates of the two points to be connected. patchA (or patchB) is given, the returned path is clipped so that it start (or end) from the boundary of the patch. The path is further shrunk by shrinkA (or shrinkB) which is given in points.
Bases: matplotlib.patches._Base
Creates a picewise continuous quadratic bezier path between two points. The path has a one passing-through point placed at the intersecting point of two lines which crosses the start (or end) point and has a angle of angleA (or angleB). The connecting edges are rounded with rad.
Bases: matplotlib.patches._Base
Creates a simple quadratic bezier curve between two points. The middle control points is placed at the intersecting point of two lines which crosses the start (or end) point and has a angle of angleA (or angleB).
Bases: matplotlib.patches._Base
Creates a picewise 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 point A, another point with respect to point B. The edges are rounded with rad.
Bases: matplotlib.patches._Base
Creates a simple quadratic bezier curve between two points. The curve is created so that the middle contol points (C1) is located at the same distance from the start (C0) and end points(C2) and the distance of the C1 to the line connecting C0-C2 is rad times the distance of C0-C2.
rad curvature of the curve.
Bases: matplotlib.patches._Base
A line with angle between A and B with armA and armB. One of the arm is extend so that they are connected in a right angle. The length of armA is determined by (armA + fraction x AB distance). Same for armB.
armA : minimum length of armA
armB : minimum length of armB
Bases: matplotlib.patches.Patch
A scale-free ellipse.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Return the vertices of the rectangle
Bases: matplotlib.patches.Polygon
Like Arrow, but lets you set head width and head height independently.
Other valid kwargs (inherited from Patch) are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Bases: matplotlib.patches.Patch
A fancy arrow patch. It draws an arrow using the :class:ArrowStyle.
If posA and posB is given, a path connecting two point are created according to the connectionstyle. The path will be clipped with patchA and patchB and further shirnked by shrinkA and shrinkB. An arrow is drawn along this resulting path using the arrowstyle parameter. If path provided, an arrow is drawn along this path and patchA, patchB, shrinkA, and shrinkB are ignored.
The connectionstyle describes how posA and posB are connected. It can be an instance of the ConnectionStyle class (matplotlib.patches.ConnectionStlye) or a string of the connectionstyle name, with optional comma-separated attributes. The following connection styles are available.
Class Name Attrs Angle angle angleA=90,angleB=0,rad=0.0 Angle3 angle3 angleA=90,angleB=0 Arc arc angleA=0,angleB=0,armA=None,armB=None,rad=0.0 Arc3 arc3 rad=0.0 Bar bar armA=0.0,armB=0.0,fraction=0.3,angle=None
The arrowstyle describes how the fancy arrow will be drawn. It can be string of the available arrowstyle names, with optional comma-separated attributes, or one of the ArrowStyle instance. The optional attributes are meant to be scaled with the mutation_scale. The following arrow styles are available.
Class Name Attrs Curve - None CurveB -> head_length=0.4,head_width=0.2 BracketB -[ widthB=1.0,lengthB=0.2,angleB=None CurveFilledB -|> head_length=0.4,head_width=0.2 CurveA <- head_length=0.4,head_width=0.2 CurveAB <-> head_length=0.4,head_width=0.2 CurveFilledA <|- head_length=0.4,head_width=0.2 CurveFilledAB <|-|> head_length=0.4,head_width=0.2 BracketA ]- widthA=1.0,lengthA=0.2,angleA=None BracketAB ]-[ widthA=1.0,lengthA=0.2,angleA=None,widthB=1.0,lengthB=0.2,angleB=None Fancy fancy head_length=0.4,head_width=0.4,tail_width=0.4 Simple simple head_length=0.5,head_width=0.5,tail_width=0.2 Wedge wedge tail_width=0.3,shrink_factor=0.5 BarAB |-| widthA=1.0,angleA=None,widthB=1.0,angleB=None
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Return the arrowstyle object
Return the ConnectionStyle instance
dpi_cor is currently used for linewidth-related things and shink factor. Mutation scale is not affected by this.
Return the aspect ratio of the bbox mutation.
Return the mutation scale.
return the path of the arrow in the data coordinate. Use get_path_in_displaycoord() method to retrieve the arrow path in the display coord.
Return the mutated path of the arrow in the display coord
Set the arrow style.
comma-separated attributes. Alternatively, the attrs can be provided as keywords.
set_arrowstyle(“Fancy,head_length=0.2”) set_arrowstyle(“fancy”, head_length=0.2)
Old attrs simply are forgotten.
Without argument (or with arrowstyle=None), return available box styles as a list of strings.
Set the connection style.
optional comma-separated attributes. Alternatively, the attrs can be probided as keywords.
set_connectionstyle(“arc,angleA=0,armA=30,rad=10”) set_connectionstyle(“arc”, angleA=0,armA=30,rad=10)
Old attrs simply are forgotten.
Without argument (or with connectionstyle=None), return available styles as a list of strings.
dpi_cor is currently used for linewidth-related things and shink factor. Mutation scale is not affected by this.
Set the aspect ratio of the bbox mutation.
ACCEPTS: float
Set the mutation scale.
ACCEPTS: float
set the begin patch.
set the begin patch
set the begin end end positions of the connecting path. Use current vlaue if None.
Bases: matplotlib.patches.Patch
Draw a fancy box around a rectangle with lower left at xy*=(*x, y) with specified width and height.
FancyBboxPatch class is similar to Rectangle class, but it draws a fancy box around the rectangle. The transformation of the rectangle box to the fancy box is delegated to the BoxTransmuterBase and its derived classes.
xy = lower left corner
width, height
boxstyle determines what kind of fancy box will be drawn. It can be a string of the style name with a comma separated attribute, or an instance of BoxStyle. Following box styles are available.
Class Name Attrs Circle circle pad=0.3 DArrow darrow pad=0.3 LArrow larrow pad=0.3 RArrow rarrow pad=0.3 Round round pad=0.3,rounding_size=None Round4 round4 pad=0.3,rounding_size=None Roundtooth roundtooth pad=0.3,tooth_size=None Sawtooth sawtooth pad=0.3,tooth_size=None Square square pad=0.3
mutation_scale : a value with which attributes of boxstyle (e.g., pad) will be scaled. default=1.
mutation_aspect : The height of the rectangle will be squeezed by this value before the mutation and the mutated box will be stretched by the inverse of it. default=None.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Return the boxstyle object
Return the height of the rectangle
Return the aspect ratio of the bbox mutation.
Return the mutation scale.
Return the mutated path of the rectangle
Return the width of the rectangle
Return the left coord of the rectangle
Return the bottom coord of the rectangle
Set the bounds of the rectangle: l,b,w,h
ACCEPTS: (left, bottom, width, height)
Set the box style.
boxstyle can be a string with boxstyle name with optional comma-separated attributes. Alternatively, the attrs can be provided as keywords:
set_boxstyle("round,pad=0.2")
set_boxstyle("round", pad=0.2)
Old attrs simply are forgotten.
Without argument (or with boxstyle = None), it returns available box styles.
The following boxstyles are available:
Class Name Attrs Circle circle pad=0.3 DArrow darrow pad=0.3 LArrow larrow pad=0.3 RArrow rarrow pad=0.3 Round round pad=0.3,rounding_size=None Round4 round4 pad=0.3,rounding_size=None Roundtooth roundtooth pad=0.3,tooth_size=None Sawtooth sawtooth pad=0.3,tooth_size=None Square square pad=0.3
ACCEPTS: [ ‘circle’ | ‘darrow’ | ‘larrow’ | ‘rarrow’ | ‘round’ | ‘round4’ | ‘roundtooth’ | ‘sawtooth’ | ‘square’ ]
Set the width rectangle
ACCEPTS: float
Set the aspect ratio of the bbox mutation.
ACCEPTS: float
Set the mutation scale.
ACCEPTS: float
Set the width rectangle
ACCEPTS: float
Set the left coord of the rectangle
ACCEPTS: float
Set the bottom coord of the rectangle
ACCEPTS: float
Bases: matplotlib.artist.Artist
A patch is a 2D artist with a face color and an edge color.
If any of edgecolor, facecolor, linewidth, or antialiased are None, they default to their rc params setting.
The following kwarg properties are supported
Property | Description |
---|---|
agg_filter | unknown |
alpha | float or None |
animated | [True | False] |
antialiased or aa | [True | False] or None for default |
axes | an Axes instance |
capstyle | [‘butt’ | ‘round’ | ‘projecting’] |
clip_box | a matplotlib.transforms.Bbox instance |
clip_on | [True | False] |
clip_path | [ (Path, Transform) | Patch | None ] |
color | matplotlib color spec |
contains | a callable function |
edgecolor or ec | mpl color spec, or None for default, or ‘none’ for no color |
facecolor or fc | mpl color spec, or None for default, or ‘none’ for no color |
figure | a matplotlib.figure.Figure instance |
fill | [True | False] |
gid | an id string |
hatch | [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] |
joinstyle | [‘miter’ | ‘round’ | ‘bevel’] |
label | string or anything printable with ‘%s’ conversion. |
linestyle or ls | [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] |
linewidth or lw | float or None for default |
lod | [True | False] |
path_effects | unknown |
picker | [None|float|boolean|callable] |
rasterized | [True | False | None] |
sketch_params | unknown |
snap | unknown |
transform | Transform instance |
url | a url string |
visible | [True | False] |
zorder | any number |
Test whether the mouse event occurred in the patch.
Returns T/F, {}
Returns True if the given point is inside the path (transformed with its transform attribute).
return whether fill is set
Return the current capstyle
Return the Transform instance which maps data coordinates to physical coordinates.
return whether fill is set
Return the current hatching pattern
Return the current joinstyle
Return the linestyle. Will be one of [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’]
Return the line width in points.
Return the linestyle. Will be one of [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’]
Return the line width in points.
Return the Transform instance which takes patch coordinates to data coordinates.
For example, one may define a patch of a circle which represents a radius of 5 by providing coordinates for a unit circle, and a transform which scales the coordinates (the patch coordinate) by 5.
Return the path of this patch
Return a copy of the vertices used in this patch
If the patch contains Bezier curves, the curves will be interpolated by line segments. To access the curves as curves, use get_path().
alias for set_antialiased
Set the alpha tranparency of the patch.
ACCEPTS: float or None
Set whether to use antialiased rendering
ACCEPTS: [True | False] or None for default
Set the patch capstyle
ACCEPTS: [‘butt’ | ‘round’ | ‘projecting’]
Set both the edgecolor and the facecolor.
ACCEPTS: matplotlib color spec
See also
alias for set_edgecolor
Set the patch edge color
ACCEPTS: mpl color spec, or None for default, or ‘none’ for no color
Set the patch face color
ACCEPTS: mpl color spec, or None for default, or ‘none’ for no color
alias for set_facecolor
Set whether to fill the patch
ACCEPTS: [True | False]
Set the hatching pattern
hatch can be one of:
/ - diagonal hatching
\ - back diagonal
| - vertical
- - horizontal
+ - crossed
x - crossed diagonal
o - small circle
O - large circle
. - dots
* - stars
Letters can be combined, in which case all the specified hatchings are done. If same letter repeats, it increases the density of hatching of that pattern.
Hatching is supported in the PostScript, PDF, SVG and Agg backends only.
ACCEPTS: [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
Set the patch joinstyle
ACCEPTS: [‘miter’ | ‘round’ | ‘bevel’]
Set the patch linestyle
ACCEPTS: [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’]
Set the patch linewidth in points
ACCEPTS: float or None for default
alias for set_linestyle
alias for set_linewidth
Bases: matplotlib.patches.Patch
A general polycurve path patch.
path is a matplotlib.path.Path object.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
See also
Bases: matplotlib.patches.Patch
A general polygon patch.
xy is a numpy array with shape Nx2.
If closed is True, the polygon will be closed so the starting and ending points are the same.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
See also
Returns if the polygon is closed
Returns: | closed : bool
|
---|
Get the vertices of the path
Returns: | vertices : numpy array
|
---|
Set if the polygon is closed
Parameters: | closed : bool
|
---|
Set the vertices of the polygon
Parameters: | xy : numpy array or iterable of pairs
|
---|
Bases: matplotlib.patches.Patch
Draw a rectangle with lower left at xy = (x, y) with specified width and height.
rotation in degrees (anti-clockwise)
fill is a boolean indicating whether to fill the rectangle
Valid kwargs are:
Property | Description |
---|---|
agg_filter | unknown |
alpha | float or None |
animated | [True | False] |
antialiased or aa | [True | False] or None for default |
axes | an Axes instance |
capstyle | [‘butt’ | ‘round’ | ‘projecting’] |
clip_box | a matplotlib.transforms.Bbox instance |
clip_on | [True | False] |
clip_path | [ (Path, Transform) | Patch | None ] |
color | matplotlib color spec |
contains | a callable function |
edgecolor or ec | mpl color spec, or None for default, or ‘none’ for no color |
facecolor or fc | mpl color spec, or None for default, or ‘none’ for no color |
figure | a matplotlib.figure.Figure instance |
fill | [True | False] |
gid | an id string |
hatch | [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] |
joinstyle | [‘miter’ | ‘round’ | ‘bevel’] |
label | string or anything printable with ‘%s’ conversion. |
linestyle or ls | [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] |
linewidth or lw | float or None for default |
lod | [True | False] |
path_effects | unknown |
picker | [None|float|boolean|callable] |
rasterized | [True | False | None] |
sketch_params | unknown |
snap | unknown |
transform | Transform instance |
url | a url string |
visible | [True | False] |
zorder | any number |
Return the height of the rectangle
Return the vertices of the rectangle
Return the width of the rectangle
Return the left coord of the rectangle
Return the left and bottom coords of the rectangle
Return the bottom coord of the rectangle
Set the bounds of the rectangle: l,b,w,h
ACCEPTS: (left, bottom, width, height)
Set the width rectangle
ACCEPTS: float
Set the width rectangle
ACCEPTS: float
Set the left coord of the rectangle
ACCEPTS: float
Set the left and bottom coords of the rectangle
ACCEPTS: 2-item sequence
Set the bottom coord of the rectangle
ACCEPTS: float
Return the left and bottom coords of the rectangle
Bases: matplotlib.patches.Patch
A regular polygon patch.
Constructor arguments:
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Bases: matplotlib.patches.Patch
Create a shadow of the given patch offset by ox, oy. props, if not None, is a patch property update dictionary. If None, the shadow will have have the same color as the face, but darkened.
kwargs are
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Bases: matplotlib.patches.Patch
Wedge shaped patch.
Draw a wedge centered at x, y center with radius r that sweeps theta1 to theta2 (in degrees). If width is given, then a partial wedge is drawn from inner radius r - width to outer radius r.
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
Bases: matplotlib.patches.Patch
Yet another arrow class.
This is an arrow that is defined in display space and has a tip at x1, y1 and a base at x2, y2.
Constructor arguments:
Valid kwargs are:
Property Description agg_filter unknown alpha float or None animated [True | False] antialiased or aa [True | False] or None for default axes an Axes instance capstyle [‘butt’ | ‘round’ | ‘projecting’] clip_box a matplotlib.transforms.Bbox instance clip_on [True | False] clip_path [ (Path, Transform) | Patch | None ] color matplotlib color spec contains a callable function edgecolor or ec mpl color spec, or None for default, or ‘none’ for no color facecolor or fc mpl color spec, or None for default, or ‘none’ for no color figure a matplotlib.figure.Figure instance fill [True | False] gid an id string hatch [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’] joinstyle [‘miter’ | ‘round’ | ‘bevel’] label string or anything printable with ‘%s’ conversion. linestyle or ls [‘solid’ | ‘dashed’ | ‘dashdot’ | ‘dotted’] linewidth or lw float or None for default lod [True | False] path_effects unknown picker [None|float|boolean|callable] rasterized [True | False | None] sketch_params unknown snap unknown transform Transform instance url a url string visible [True | False] zorder any number
For line segment defined by (x1, y1) and (x2, y2) return the points on the line that is perpendicular to the line and intersects (x2, y2) and the distance from (x2, y2) of the returned points is k.
This is a debug function to draw a rectangle around the bounding box returned by get_window_extent() of an artist, to test whether the artist is returning the correct bbox.
props is a dict of rectangle props with the additional property ‘pad’ that sets the padding around the bbox in points.
This is a debug function to draw a rectangle around the bounding box returned by get_window_extent() of an artist, to test whether the artist is returning the correct bbox.