doc_content
stringlengths 1
386k
| doc_id
stringlengths 5
188
|
---|---|
get_aa()[source]
Alias for get_antialiased.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_aa
|
get_antialiased()[source]
Return whether antialiasing is used for drawing.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_antialiased
|
get_capstyle()[source]
Return the capstyle.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_capstyle
|
get_data_transform()[source]
Return the Transform mapping data coordinates to physical coordinates.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_data_transform
|
get_ec()[source]
Alias for get_edgecolor.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_ec
|
get_edgecolor()[source]
Return the edge color.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_edgecolor
|
get_extents()[source]
Return the Patch's axis-aligned extents as a Bbox.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_extents
|
get_facecolor()[source]
Return the face color.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_facecolor
|
get_fc()[source]
Alias for get_facecolor.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_fc
|
get_fill()[source]
Return whether the patch is filled.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_fill
|
get_hatch()[source]
Return the hatching pattern.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_hatch
|
get_joinstyle()[source]
Return the joinstyle.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_joinstyle
|
get_linestyle()[source]
Return the linestyle.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_linestyle
|
get_linewidth()[source]
Return the line width in points.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_linewidth
|
get_ls()[source]
Alias for get_linestyle.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_ls
|
get_lw()[source]
Alias for get_linewidth.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_lw
|
get_patch_transform()[source]
Return the Transform instance mapping 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.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_patch_transform
|
get_path()[source]
Return the path of this patch.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_path
|
get_transform()[source]
Return the Transform applied to the Patch.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_transform
|
get_verts()[source]
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.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_verts
|
get_window_extent(renderer=None)[source]
Get the artist's bounding box in display space. The bounding box' width and height are nonnegative. Subclasses should override for inclusion in the bounding box "tight" calculation. Default is to return an empty bounding box at 0, 0. Be careful when using this function, the results will not update if the artist window extent of the artist changes. The extent can change due to any changes in the transform stack, such as changing the axes limits, the figure size, or the canvas used (as is done when saving a figure). This can lead to unexpected behavior where interactive figures will look fine on the screen, but will save incorrectly.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.get_window_extent
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor color or None
facecolor color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set
|
set_aa(aa)[source]
Alias for set_antialiased.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_aa
|
set_alpha(alpha)[source]
Set the alpha value used for blending - not supported on all backends. Parameters
alphascalar or None
alpha must be within the 0-1 range, inclusive.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_alpha
|
set_antialiased(aa)[source]
Set whether to use antialiased rendering. Parameters
aabool or None
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_antialiased
|
set_capstyle(s)[source]
Set the CapStyle. Parameters
sCapStyle or {'butt', 'projecting', 'round'}
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_capstyle
|
set_color(c)[source]
Set both the edgecolor and the facecolor. Parameters
ccolor
See also
Patch.set_facecolor, Patch.set_edgecolor
For setting the edge or face color individually.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_color
|
set_ec(color)[source]
Alias for set_edgecolor.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_ec
|
set_edgecolor(color)[source]
Set the patch edge color. Parameters
colorcolor or None
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_edgecolor
|
set_facecolor(color)[source]
Set the patch face color. Parameters
colorcolor or None
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_facecolor
|
set_fc(color)[source]
Alias for set_facecolor.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_fc
|
set_fill(b)[source]
Set whether to fill the patch. Parameters
bbool
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_fill
|
set_hatch(hatch)[source]
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. Parameters
hatch{'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_hatch
|
set_joinstyle(s)[source]
Set the JoinStyle. Parameters
sJoinStyle or {'miter', 'round', 'bevel'}
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_joinstyle
|
set_linestyle(ls)[source]
Set the patch linestyle.
linestyle description
'-' or 'solid' solid line
'--' or 'dashed' dashed line
'-.' or 'dashdot' dash-dotted line
':' or 'dotted' dotted line
'none', 'None', ' ', or '' draw nothing Alternatively a dash tuple of the following form can be provided: (offset, onoffseq)
where onoffseq is an even length tuple of on and off ink in points. Parameters
ls{'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
The line style.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_linestyle
|
set_linewidth(w)[source]
Set the patch linewidth in points. Parameters
wfloat or None
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_linewidth
|
set_ls(ls)[source]
Alias for set_linestyle.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_ls
|
set_lw(w)[source]
Alias for set_linewidth.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.set_lw
|
update_from(other)[source]
Copy properties from other to self.
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.update_from
|
validCap=('butt', 'projecting', 'round')
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.validCap
|
validJoin=('miter', 'round', 'bevel')
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.validJoin
|
zorder=1
|
matplotlib._as_gen.matplotlib.patches.patch#matplotlib.patches.Patch.zorder
|
matplotlib.patches.PathPatch classmatplotlib.patches.PathPatch(path, **kwargs)[source]
Bases: matplotlib.patches.Patch A general polycurve path patch. path is a Path object. Valid keyword arguments are:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float get_path()[source]
Return the path of this patch.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
set_path(path)[source]
Examples using matplotlib.patches.PathPatch
Curve with error band
Stairs Demo
Image Demo
Box plots with custom fill colors
Using a text as a Path
Reference for Matplotlib artists
Compound path
Dolphins
Mmh Donuts!!!
PathPatch object
Bezier Curve
Firefox
Path Editor
Building histograms using Rectangles and PolyCollections
Matplotlib logo
TickedStroke patheffect
Draw flat objects in 3D plot
Path Tutorial
|
matplotlib._as_gen.matplotlib.patches.pathpatch
|
get_path()[source]
Return the path of this patch.
|
matplotlib._as_gen.matplotlib.patches.pathpatch#matplotlib.patches.PathPatch.get_path
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.patches.pathpatch#matplotlib.patches.PathPatch.set
|
set_path(path)[source]
|
matplotlib._as_gen.matplotlib.patches.pathpatch#matplotlib.patches.PathPatch.set_path
|
matplotlib.patches.Polygon classmatplotlib.patches.Polygon(xy, closed=True, **kwargs)[source]
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 keyword arguments are:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float get_closed()[source]
Return whether the polygon is closed.
get_path()[source]
Get the Path of the polygon.
get_xy()[source]
Get the vertices of the path. Returns
(N, 2) numpy array
The coordinates of the vertices.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, closed=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xy=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
closed bool
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
xy (N, 2) array-like
zorder float
set_closed(closed)[source]
Set whether the polygon is closed. Parameters
closedbool
True if the polygon is closed
set_xy(xy)[source]
Set the vertices of the polygon. Parameters
xy(N, 2) array-like
The coordinates of the vertices. Notes 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.
propertyxy
The vertices of the path as (N, 2) numpy array.
Examples using matplotlib.patches.Polygon
Controlling view limits using margins and sticky_edges
Boxplots
Arrow guide
Hatch demo
Circles, Wedges and Polygons
mpl_toolkits.axisartist.floating_axes features
Integral as the area under a curve
Poly Editor
Trifinder Event Demo
Annotations
|
matplotlib._as_gen.matplotlib.patches.polygon
|
get_closed()[source]
Return whether the polygon is closed.
|
matplotlib._as_gen.matplotlib.patches.polygon#matplotlib.patches.Polygon.get_closed
|
get_path()[source]
Get the Path of the polygon.
|
matplotlib._as_gen.matplotlib.patches.polygon#matplotlib.patches.Polygon.get_path
|
get_xy()[source]
Get the vertices of the path. Returns
(N, 2) numpy array
The coordinates of the vertices.
|
matplotlib._as_gen.matplotlib.patches.polygon#matplotlib.patches.Polygon.get_xy
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, closed=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, xy=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
closed bool
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
xy (N, 2) array-like
zorder float
|
matplotlib._as_gen.matplotlib.patches.polygon#matplotlib.patches.Polygon.set
|
set_closed(closed)[source]
Set whether the polygon is closed. Parameters
closedbool
True if the polygon is closed
|
matplotlib._as_gen.matplotlib.patches.polygon#matplotlib.patches.Polygon.set_closed
|
set_xy(xy)[source]
Set the vertices of the polygon. Parameters
xy(N, 2) array-like
The coordinates of the vertices. Notes 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.
|
matplotlib._as_gen.matplotlib.patches.polygon#matplotlib.patches.Polygon.set_xy
|
matplotlib.patches.Rectangle classmatplotlib.patches.Rectangle(xy, width, height, angle=0.0, **kwargs)[source]
Bases: matplotlib.patches.Patch A rectangle defined via an anchor point xy and its width and height. The rectangle extends from xy[0] to xy[0] + width in x-direction and from xy[1] to xy[1] + height in y-direction. : +------------------+
: | |
: height |
: | |
: (xy)---- width -----+
One may picture xy as the bottom left corner, but which corner xy is actually depends on the direction of the axis and the sign of width and height; e.g. xy would be the bottom right corner if the x-axis was inverted or if width was negative. Parameters
xy(float, float)
The anchor point.
widthfloat
Rectangle width.
heightfloat
Rectangle height.
anglefloat, default: 0
Rotation in degrees anti-clockwise about xy. Other Parameters
**kwargsPatch properties
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float get_angle()[source]
Get the rotation angle in degrees.
get_bbox()[source]
Return the Bbox.
get_height()[source]
Return the height of the rectangle.
get_patch_transform()[source]
Return the Transform instance mapping 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.
get_path()[source]
Return the vertices of the rectangle.
get_width()[source]
Return the width of the rectangle.
get_x()[source]
Return the left coordinate of the rectangle.
get_xy()[source]
Return the left and bottom coords of the rectangle as a tuple.
get_y()[source]
Return the bottom coordinate of the rectangle.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, angle=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, bounds=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, height=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, x=<UNSET>, xy=<UNSET>, y=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
angle unknown
animated bool
antialiased or aa bool or None
bounds (left, bottom, width, height)
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
height unknown
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
width unknown
x unknown
xy (float, float)
y unknown
zorder float
set_angle(angle)[source]
Set the rotation angle in degrees. The rotation is performed anti-clockwise around xy.
set_bounds(*args)[source]
Set the bounds of the rectangle as left, bottom, width, height. The values may be passed as separate parameters or as a tuple: set_bounds(left, bottom, width, height)
set_bounds((left, bottom, width, height))
set_height(h)[source]
Set the height of the rectangle.
set_width(w)[source]
Set the width of the rectangle.
set_x(x)[source]
Set the left coordinate of the rectangle.
set_xy(xy)[source]
Set the left and bottom coordinates of the rectangle. Parameters
xy(float, float)
set_y(y)[source]
Set the bottom coordinate of the rectangle.
propertyxy
Return the left and bottom coords of the rectangle as a tuple.
Examples using matplotlib.patches.Rectangle
Creating boxes from error bars using PatchCollection
Histograms
Text Rotation Mode
Precise text layout
Fig Axes Customize Simple
Text Layout
List of named colors
Reference for Matplotlib artists
Hatch style reference
Inset Locator Demo
Anatomy of a figure
Pick Event Demo
Viewlims
Changing colors of lines intersecting a box
Matplotlib logo
Hinton diagrams
Artist tests
Menu
Artist tutorial
Legend guide
Transformations Tutorial
Specifying Colors
Text properties and layout
|
matplotlib._as_gen.matplotlib.patches.rectangle
|
get_angle()[source]
Get the rotation angle in degrees.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_angle
|
get_bbox()[source]
Return the Bbox.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_bbox
|
get_height()[source]
Return the height of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_height
|
get_patch_transform()[source]
Return the Transform instance mapping 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.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_patch_transform
|
get_path()[source]
Return the vertices of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_path
|
get_width()[source]
Return the width of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_width
|
get_x()[source]
Return the left coordinate of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_x
|
get_xy()[source]
Return the left and bottom coords of the rectangle as a tuple.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_xy
|
get_y()[source]
Return the bottom coordinate of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.get_y
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, angle=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, bounds=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, height=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, x=<UNSET>, xy=<UNSET>, y=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
angle unknown
animated bool
antialiased or aa bool or None
bounds (left, bottom, width, height)
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
height unknown
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
width unknown
x unknown
xy (float, float)
y unknown
zorder float
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set
|
set_angle(angle)[source]
Set the rotation angle in degrees. The rotation is performed anti-clockwise around xy.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_angle
|
set_bounds(*args)[source]
Set the bounds of the rectangle as left, bottom, width, height. The values may be passed as separate parameters or as a tuple: set_bounds(left, bottom, width, height)
set_bounds((left, bottom, width, height))
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_bounds
|
set_height(h)[source]
Set the height of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_height
|
set_width(w)[source]
Set the width of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_width
|
set_x(x)[source]
Set the left coordinate of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_x
|
set_xy(xy)[source]
Set the left and bottom coordinates of the rectangle. Parameters
xy(float, float)
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_xy
|
set_y(y)[source]
Set the bottom coordinate of the rectangle.
|
matplotlib._as_gen.matplotlib.patches.rectangle#matplotlib.patches.Rectangle.set_y
|
matplotlib.patches.RegularPolygon classmatplotlib.patches.RegularPolygon(xy, numVertices, radius=5, orientation=0, **kwargs)[source]
Bases: matplotlib.patches.Patch A regular polygon patch. Parameters
xy(float, float)
The center position.
numVerticesint
The number of vertices.
radiusfloat
The distance from the center to each of the vertices.
orientationfloat
The polygon rotation angle (in radians). **kwargs
Patch properties:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float get_patch_transform()[source]
Return the Transform instance mapping 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.
get_path()[source]
Return the path of this patch.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
Examples using matplotlib.patches.RegularPolygon
Reference for Matplotlib artists
Radar chart (aka spider or star chart)
|
matplotlib._as_gen.matplotlib.patches.regularpolygon
|
get_patch_transform()[source]
Return the Transform instance mapping 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.
|
matplotlib._as_gen.matplotlib.patches.regularpolygon#matplotlib.patches.RegularPolygon.get_patch_transform
|
get_path()[source]
Return the path of this patch.
|
matplotlib._as_gen.matplotlib.patches.regularpolygon#matplotlib.patches.RegularPolygon.get_path
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.patches.regularpolygon#matplotlib.patches.RegularPolygon.set
|
matplotlib.patches.Shadow classmatplotlib.patches.Shadow(patch, ox, oy, **kwargs)[source]
Bases: matplotlib.patches.Patch Create a shadow of the given patch. By default, the shadow will have the same face color as the patch, but darkened. Parameters
patchPatch
The patch to create the shadow for.
ox, oyfloat
The shift of the shadow in data coordinates, scaled by a factor of dpi/72. **kwargs
Properties of the shadow patch. Supported keys are:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float draw(renderer)[source]
Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters
rendererRendererBase subclass.
Notes This method is overridden in the Artist subclasses.
get_patch_transform()[source]
Return the Transform instance mapping 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.
get_path()[source]
Return the path of this patch.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
Examples using matplotlib.patches.Shadow
Using a text as a Path
SVG Filter Pie
|
matplotlib._as_gen.matplotlib.patches.shadow
|
draw(renderer)[source]
Draw the Artist (and its children) using the given renderer. This has no effect if the artist is not visible (Artist.get_visible returns False). Parameters
rendererRendererBase subclass.
Notes This method is overridden in the Artist subclasses.
|
matplotlib._as_gen.matplotlib.patches.shadow#matplotlib.patches.Shadow.draw
|
get_patch_transform()[source]
Return the Transform instance mapping 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.
|
matplotlib._as_gen.matplotlib.patches.shadow#matplotlib.patches.Shadow.get_patch_transform
|
get_path()[source]
Return the path of this patch.
|
matplotlib._as_gen.matplotlib.patches.shadow#matplotlib.patches.Shadow.get_path
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.patches.shadow#matplotlib.patches.Shadow.set
|
matplotlib.patches.StepPatch classmatplotlib.patches.StepPatch(values, edges, *, orientation='vertical', baseline=0, **kwargs)[source]
Bases: matplotlib.patches.PathPatch A path patch describing a stepwise constant function. By default the path is not closed and starts and stops at baseline value. Parameters
valuesarray-like
The step heights.
edgesarray-like
The edge positions, with len(edges) == len(vals) + 1, between which the curve takes on vals values.
orientation{'vertical', 'horizontal'}, default: 'vertical'
The direction of the steps. Vertical means that values are along the y-axis, and edges are along the x-axis.
baselinefloat, array-like or None, default: 0
The bottom value of the bounding edges or when fill=True, position of lower edge. If fill is True or an array is passed to baseline, a closed path is drawn. Other valid keyword arguments are:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float get_data()[source]
Get StepPatch values, edges and baseline as namedtuple.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, data=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
data 1D array-like or None
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
set_data(values=None, edges=None, baseline=None)[source]
Set StepPatch values, edges and baseline. Parameters
values1D array-like or None
Will not update values, if passing None
edges1D array-like, optional
baselinefloat, 1D array-like or None
Examples using matplotlib.patches.StepPatch
Stairs Demo
|
matplotlib._as_gen.matplotlib.patches.steppatch
|
get_data()[source]
Get StepPatch values, edges and baseline as namedtuple.
|
matplotlib._as_gen.matplotlib.patches.steppatch#matplotlib.patches.StepPatch.get_data
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, data=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
data 1D array-like or None
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path unknown
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float
|
matplotlib._as_gen.matplotlib.patches.steppatch#matplotlib.patches.StepPatch.set
|
set_data(values=None, edges=None, baseline=None)[source]
Set StepPatch values, edges and baseline. Parameters
values1D array-like or None
Will not update values, if passing None
edges1D array-like, optional
baselinefloat, 1D array-like or None
|
matplotlib._as_gen.matplotlib.patches.steppatch#matplotlib.patches.StepPatch.set_data
|
matplotlib.patches.Wedge classmatplotlib.patches.Wedge(center, r, theta1, theta2, width=None, **kwargs)[source]
Bases: matplotlib.patches.Patch Wedge shaped patch. 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 keyword arguments are:
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha unknown
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
transform Transform
url str
visible bool
zorder float get_path()[source]
Return the path of this patch.
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, center=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, radius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, theta1=<UNSET>, theta2=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
center unknown
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
radius unknown
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
theta1 unknown
theta2 unknown
transform Transform
url str
visible bool
width unknown
zorder float
set_center(center)[source]
set_radius(radius)[source]
set_theta1(theta1)[source]
set_theta2(theta2)[source]
set_width(width)[source]
Examples using matplotlib.patches.Wedge
Labeling a pie and a donut
Reference for Matplotlib artists
Circles, Wedges and Polygons
SVG Filter Pie
|
matplotlib._as_gen.matplotlib.patches.wedge
|
get_path()[source]
Return the path of this patch.
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.get_path
|
set(*, agg_filter=<UNSET>, alpha=<UNSET>, animated=<UNSET>, antialiased=<UNSET>, capstyle=<UNSET>, center=<UNSET>, clip_box=<UNSET>, clip_on=<UNSET>, clip_path=<UNSET>, color=<UNSET>, edgecolor=<UNSET>, facecolor=<UNSET>, fill=<UNSET>, gid=<UNSET>, hatch=<UNSET>, in_layout=<UNSET>, joinstyle=<UNSET>, label=<UNSET>, linestyle=<UNSET>, linewidth=<UNSET>, path_effects=<UNSET>, picker=<UNSET>, radius=<UNSET>, rasterized=<UNSET>, sketch_params=<UNSET>, snap=<UNSET>, theta1=<UNSET>, theta2=<UNSET>, transform=<UNSET>, url=<UNSET>, visible=<UNSET>, width=<UNSET>, zorder=<UNSET>)[source]
Set multiple properties at once. Supported properties are
Property Description
agg_filter a filter function, which takes a (m, n, 3) float array and a dpi value, and returns a (m, n, 3) array
alpha scalar or None
animated bool
antialiased or aa bool or None
capstyle CapStyle or {'butt', 'projecting', 'round'}
center unknown
clip_box Bbox
clip_on bool
clip_path Patch or (Path, Transform) or None
color color
edgecolor or ec color or None
facecolor or fc color or None
figure Figure
fill bool
gid str
hatch {'/', '\', '|', '-', '+', 'x', 'o', 'O', '.', '*'}
in_layout bool
joinstyle JoinStyle or {'miter', 'round', 'bevel'}
label object
linestyle or ls {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
linewidth or lw float or None
path_effects AbstractPathEffect
picker None or bool or float or callable
radius unknown
rasterized bool
sketch_params (scale: float, length: float, randomness: float)
snap bool or None
theta1 unknown
theta2 unknown
transform Transform
url str
visible bool
width unknown
zorder float
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.set
|
set_center(center)[source]
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.set_center
|
set_radius(radius)[source]
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.set_radius
|
set_theta1(theta1)[source]
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.set_theta1
|
set_theta2(theta2)[source]
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.set_theta2
|
set_width(width)[source]
|
matplotlib._as_gen.matplotlib.patches.wedge#matplotlib.patches.Wedge.set_width
|
matplotlib.path A module for dealing with the polylines used throughout Matplotlib. The primary class for polyline handling in Matplotlib is Path. Almost all vector drawing makes use of Paths somewhere in the drawing pipeline. Whilst a Path instance itself cannot be drawn, some Artist subclasses, such as PathPatch and PathCollection, can be used for convenient Path visualisation. classmatplotlib.path.Path(vertices, codes=None, _interpolation_steps=1, closed=False, readonly=False)[source]
Bases: object A series of possibly disconnected, possibly closed, line and curve segments. The underlying storage is made up of two parallel numpy arrays:
vertices: an Nx2 float array of vertices
codes: an N-length uint8 array of path codes, or None These two arrays always have the same length in the first dimension. For example, to represent a cubic curve, you must provide three vertices and three CURVE4 codes. The code types are:
STOP1 vertex (ignored)
A marker for the end of the entire path (currently not required and ignored)
MOVETO1 vertex
Pick up the pen and move to the given vertex.
LINETO1 vertex
Draw a line from the current position to the given vertex.
CURVE31 control point, 1 endpoint
Draw a quadratic Bezier curve from the current position, with the given control point, to the given end point.
CURVE42 control points, 1 endpoint
Draw a cubic Bezier curve from the current position, with the given control points, to the given end point.
CLOSEPOLY1 vertex (ignored)
Draw a line segment to the start point of the current polyline. If codes is None, it is interpreted as a MOVETO followed by a series of LINETO. Users of Path objects should not access the vertices and codes arrays directly. Instead, they should use iter_segments or cleaned to get the vertex/code pairs. This helps, in particular, to consistently handle the case of codes being None. Some behavior of Path objects can be controlled by rcParams. See the rcParams whose keys start with 'path.'. Note The vertices and codes arrays should be treated as immutable -- there are a number of optimizations and assumptions made up front in the constructor that will not change when the data changes. Create a new path with the given vertices and codes. Parameters
vertices(N, 2) array-like
The path vertices, as an array, masked array or sequence of pairs. Masked values, if any, will be converted to NaNs, which are then handled correctly by the Agg PathIterator and other consumers of path data, such as iter_segments().
codesarray-like or None, optional
N-length array of integers representing the codes of the path. If not None, codes must be the same length as vertices. If None, vertices will be treated as a series of line segments.
_interpolation_stepsint, optional
Used as a hint to certain projections, such as Polar, that this path should be linearly interpolated immediately before drawing. This attribute is primarily an implementation detail and is not intended for public use.
closedbool, optional
If codes is None and closed is True, vertices will be treated as line segments of a closed polygon. Note that the last vertex will then be ignored (as the corresponding code will be set to CLOSEPOLY).
readonlybool, optional
Makes the path behave in an immutable way and sets the vertices and codes as read-only arrays. CLOSEPOLY=79
CURVE3=3
CURVE4=4
LINETO=2
MOVETO=1
NUM_VERTICES_FOR_CODE={0: 1, 1: 1, 2: 1, 3: 2, 4: 3, 79: 1}
A dictionary mapping Path codes to the number of vertices that the code expects.
STOP=0
classmethodarc(theta1, theta2, n=None, is_wedge=False)[source]
Return a Path for the unit circle arc from angles theta1 to theta2 (in degrees). theta2 is unwrapped to produce the shortest arc within 360 degrees. That is, if theta2 > theta1 + 360, the arc will be from theta1 to theta2 - 360 and not a full circle plus some extra overlap. If n is provided, it is the number of spline segments to make. If n is not provided, the number of spline segments is determined based on the delta between theta1 and theta2. Masionobe, L. 2003. Drawing an elliptical arc using polylines, quadratic or cubic Bezier curves.
classmethodcircle(center=(0.0, 0.0), radius=1.0, readonly=False)[source]
Return a Path representing a circle of a given radius and center. Parameters
center(float, float), default: (0, 0)
The center of the circle.
radiusfloat, default: 1
The radius of the circle.
readonlybool
Whether the created path should have the "readonly" argument set when creating the Path instance. Notes The circle is approximated using 8 cubic Bezier curves, as described in Lancaster, Don. Approximating a Circle or an Ellipse Using Four Bezier Cubic Splines.
cleaned(transform=None, remove_nans=False, clip=None, *, simplify=False, curves=False, stroke_width=1.0, snap=False, sketch=None)[source]
Return a new Path with vertices and codes cleaned according to the parameters. See also Path.iter_segments
for details of the keyword arguments.
clip_to_bbox(bbox, inside=True)[source]
Clip the path to the given bounding box. The path must be made up of one or more closed polygons. This algorithm will not behave correctly for unclosed paths. If inside is True, clip to the inside of the box, otherwise to the outside of the box.
code_type
alias of numpy.uint8
propertycodes
The list of codes in the Path as a 1D numpy array. Each code is one of STOP, MOVETO, LINETO, CURVE3, CURVE4 or CLOSEPOLY. For codes that correspond to more than one vertex (CURVE3 and CURVE4), that code will be repeated so that the length of self.vertices and self.codes is always the same.
contains_path(path, transform=None)[source]
Return whether this (closed) path completely contains the given path. If transform is not None, the path will be transformed before checking for containment.
contains_point(point, transform=None, radius=0.0)[source]
Return whether the area enclosed by the path contains the given point. The path is always treated as closed; i.e. if the last code is not CLOSEPOLY an implicit segment connecting the last vertex to the first vertex is assumed. Parameters
point(float, float)
The point (x, y) to check.
transformmatplotlib.transforms.Transform, optional
If not None, point will be compared to self transformed by transform; i.e. for a correct check, transform should transform the path into the coordinate system of point.
radiusfloat, default: 0
Add an 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, negative values shrink the area: Points on the imaginary line will be considered outside the area. Returns
bool
Notes The current algorithm has some limitations: The result is undefined for points exactly at the boundary (i.e. at the path shifted by radius/2). The result is undefined if there is no enclosed area, i.e. all vertices are on a straight line. If bounding lines start to cross each other due to radius shift, the result is not guaranteed to be correct.
contains_points(points, transform=None, radius=0.0)[source]
Return whether the area enclosed by the path contains the given points. The path is always treated as closed; i.e. if the last code is not CLOSEPOLY an implicit segment connecting the last vertex to the first vertex is assumed. Parameters
points(N, 2) array
The points to check. Columns contain x and y values.
transformmatplotlib.transforms.Transform, optional
If not None, points will be compared to self transformed by transform; i.e. for a correct check, transform should transform the path into the coordinate system of points.
radiusfloat, default: 0
Add an 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, negative values shrink the area: Points on the imaginary line will be considered outside the area. Returns
length-N bool array
Notes The current algorithm has some limitations: The result is undefined for points exactly at the boundary (i.e. at the path shifted by radius/2). The result is undefined if there is no enclosed area, i.e. all vertices are on a straight line. If bounding lines start to cross each other due to radius shift, the result is not guaranteed to be correct.
copy()[source]
Return a shallow copy of the Path, which will share the vertices and codes with the source Path.
deepcopy(memo=None)[source]
Return a deepcopy of the Path. The Path will not be readonly, even if the source Path is.
get_extents(transform=None, **kwargs)[source]
Get Bbox of the path. Parameters
transformmatplotlib.transforms.Transform, optional
Transform to apply to path before computing extents, if any. **kwargs
Forwarded to iter_bezier. Returns
matplotlib.transforms.Bbox
The extents of the path Bbox([[xmin, ymin], [xmax, ymax]])
statichatch(hatchpattern, density=6)[source]
Given a hatch specifier, hatchpattern, generates a Path that can be used in a repeated hatching pattern. density is the number of lines per unit square.
interpolated(steps)[source]
Return a new path resampled to length N x steps. Codes other than LINETO are not handled correctly.
intersects_bbox(bbox, filled=True)[source]
Return whether this path intersects a given Bbox. If filled is True, then this also returns True if the path completely encloses the Bbox (i.e., the path is treated as filled). The bounding box is always considered filled.
intersects_path(other, filled=True)[source]
Return whether if this path intersects another given path. If filled is True, then this also returns True if one path completely encloses the other (i.e., the paths are treated as filled).
iter_bezier(**kwargs)[source]
Iterate over each bezier curve (lines included) in a Path. Parameters
**kwargs
Forwarded to iter_segments. Yields
Bmatplotlib.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).
codePath.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). Path.CLOSEPOLY is a Path.LINETO with the control points correctly chosen based on the start/end points of the current stroke.
iter_segments(transform=None, remove_nans=True, clip=None, snap=False, stroke_width=1.0, simplify=None, curves=True, sketch=None)[source]
Iterate over all curve segments in the path. Each iteration returns a pair (vertices, code), where vertices is a sequence of 1-3 coordinate pairs, and code is a Path code. Additionally, this method can provide a number of standard cleanups and conversions to the path. Parameters
transformNone or Transform
If not None, the given affine transformation will be applied to the path.
remove_nansbool, optional
Whether to remove all NaNs from the path and skip over them using MOVETO commands.
clipNone or (float, float, float, float), optional
If not None, must be a four-tuple (x1, y1, x2, y2) defining a rectangle in which to clip the path.
snapNone or bool, optional
If True, snap all nodes to pixels; if False, don't snap them. If None, snap if the path contains only segments parallel to the x or y axes, and no more than 1024 of them.
stroke_widthfloat, optional
The width of the stroke being drawn (used for path snapping).
simplifyNone or bool, optional
Whether to simplify the path by removing vertices that do not affect its appearance. If None, use the should_simplify attribute. See also rcParams["path.simplify"] (default: True) and rcParams["path.simplify_threshold"] (default: 0.111111111111).
curvesbool, optional
If True, curve segments will be returned as curve segments. If False, all curves will be converted to line segments.
sketchNone or sequence, optional
If not None, must be a 3-tuple of the form (scale, length, randomness), representing the sketch parameters.
classmethodmake_compound_path(*args)[source]
Make a compound path from a list of Path objects. Blindly removes all Path.STOP control points.
classmethodmake_compound_path_from_polys(XY)[source]
Make a compound path object to draw a number of polygons with equal numbers of sides XY is a (numpolys x numsides x 2) numpy array of vertices. Return object is a Path. (Source code, png, pdf)
propertyreadonly
True if the Path is read-only.
propertyshould_simplify
True if the vertices array should be simplified.
propertysimplify_threshold
The fraction of a pixel difference below which vertices will be simplified out.
to_polygons(transform=None, width=0, height=0, closed_only=True)[source]
Convert this path to a list of polygons or polylines. Each 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. If width and height are both non-zero then the lines will be simplified so that vertices outside of (0, 0), (width, height) will be clipped. If closed_only is True (default), only closed polygons, with the last point being the same as the first point, will be returned. Any unclosed polylines in the path will be explicitly closed. If closed_only is False, any unclosed polygons in the path will be returned as unclosed polygons, and the closed polygons will be returned explicitly closed by setting the last point to the same as the first point.
transformed(transform)[source]
Return a transformed copy of the path. See also matplotlib.transforms.TransformedPath
A specialized path class that will cache the transformed result and automatically update when the transform changes.
classmethodunit_circle()[source]
Return the readonly Path of the unit circle. For most cases, Path.circle() will be what you want.
classmethodunit_circle_righthalf()[source]
Return a Path of the right half of a unit circle. See Path.circle for the reference on the approximation used.
classmethodunit_rectangle()[source]
Return a Path instance of the unit rectangle from (0, 0) to (1, 1).
classmethodunit_regular_asterisk(numVertices)[source]
Return a Path for a unit regular asterisk with the given numVertices and radius of 1.0, centered at (0, 0).
classmethodunit_regular_polygon(numVertices)[source]
Return a Path instance for a unit regular polygon with the given numVertices such that the circumscribing circle has radius 1.0, centered at (0, 0).
classmethodunit_regular_star(numVertices, innerCircle=0.5)[source]
Return a Path for a unit regular star with the given numVertices and radius of 1.0, centered at (0, 0).
propertyvertices
The list of vertices in the Path as an Nx2 numpy array.
classmethodwedge(theta1, theta2, n=None)[source]
Return a Path for the unit circle wedge from angles theta1 to theta2 (in degrees). theta2 is unwrapped to produce the shortest wedge within 360 degrees. That is, if theta2 > theta1 + 360, the wedge will be from theta1 to theta2 - 360 and not a full circle plus some extra overlap. If n is provided, it is the number of spline segments to make. If n is not provided, the number of spline segments is determined based on the delta between theta1 and theta2. See Path.arc for the reference on the approximation used.
matplotlib.path.get_path_collection_extents(master_transform, paths, transforms, offsets, offset_transform)[source]
Given a sequence of Paths, Transforms objects, and offsets, as found in a PathCollection, returns the bounding box that encapsulates all of them. Parameters
master_transformTransform
Global transformation applied to all paths.
pathslist of Path
transformslist of Affine2D
offsets(N, 2) array-like
offset_transformAffine2D
Transform applied to the offsets before offsetting the path. Notes The way that paths, transforms and offsets are combined follows the same method as for collections: Each is iterated over independently, so if you have 3 paths, 2 transforms and 1 offset, their combinations are as follows: (A, A, A), (B, B, A), (C, A, A)
|
matplotlib.path_api
|
matplotlib.path.get_path_collection_extents(master_transform, paths, transforms, offsets, offset_transform)[source]
Given a sequence of Paths, Transforms objects, and offsets, as found in a PathCollection, returns the bounding box that encapsulates all of them. Parameters
master_transformTransform
Global transformation applied to all paths.
pathslist of Path
transformslist of Affine2D
offsets(N, 2) array-like
offset_transformAffine2D
Transform applied to the offsets before offsetting the path. Notes The way that paths, transforms and offsets are combined follows the same method as for collections: Each is iterated over independently, so if you have 3 paths, 2 transforms and 1 offset, their combinations are as follows: (A, A, A), (B, B, A), (C, A, A)
|
matplotlib.path_api#matplotlib.path.get_path_collection_extents
|
classmatplotlib.path.Path(vertices, codes=None, _interpolation_steps=1, closed=False, readonly=False)[source]
Bases: object A series of possibly disconnected, possibly closed, line and curve segments. The underlying storage is made up of two parallel numpy arrays:
vertices: an Nx2 float array of vertices
codes: an N-length uint8 array of path codes, or None These two arrays always have the same length in the first dimension. For example, to represent a cubic curve, you must provide three vertices and three CURVE4 codes. The code types are:
STOP1 vertex (ignored)
A marker for the end of the entire path (currently not required and ignored)
MOVETO1 vertex
Pick up the pen and move to the given vertex.
LINETO1 vertex
Draw a line from the current position to the given vertex.
CURVE31 control point, 1 endpoint
Draw a quadratic Bezier curve from the current position, with the given control point, to the given end point.
CURVE42 control points, 1 endpoint
Draw a cubic Bezier curve from the current position, with the given control points, to the given end point.
CLOSEPOLY1 vertex (ignored)
Draw a line segment to the start point of the current polyline. If codes is None, it is interpreted as a MOVETO followed by a series of LINETO. Users of Path objects should not access the vertices and codes arrays directly. Instead, they should use iter_segments or cleaned to get the vertex/code pairs. This helps, in particular, to consistently handle the case of codes being None. Some behavior of Path objects can be controlled by rcParams. See the rcParams whose keys start with 'path.'. Note The vertices and codes arrays should be treated as immutable -- there are a number of optimizations and assumptions made up front in the constructor that will not change when the data changes. Create a new path with the given vertices and codes. Parameters
vertices(N, 2) array-like
The path vertices, as an array, masked array or sequence of pairs. Masked values, if any, will be converted to NaNs, which are then handled correctly by the Agg PathIterator and other consumers of path data, such as iter_segments().
codesarray-like or None, optional
N-length array of integers representing the codes of the path. If not None, codes must be the same length as vertices. If None, vertices will be treated as a series of line segments.
_interpolation_stepsint, optional
Used as a hint to certain projections, such as Polar, that this path should be linearly interpolated immediately before drawing. This attribute is primarily an implementation detail and is not intended for public use.
closedbool, optional
If codes is None and closed is True, vertices will be treated as line segments of a closed polygon. Note that the last vertex will then be ignored (as the corresponding code will be set to CLOSEPOLY).
readonlybool, optional
Makes the path behave in an immutable way and sets the vertices and codes as read-only arrays. CLOSEPOLY=79
CURVE3=3
CURVE4=4
LINETO=2
MOVETO=1
NUM_VERTICES_FOR_CODE={0: 1, 1: 1, 2: 1, 3: 2, 4: 3, 79: 1}
A dictionary mapping Path codes to the number of vertices that the code expects.
STOP=0
classmethodarc(theta1, theta2, n=None, is_wedge=False)[source]
Return a Path for the unit circle arc from angles theta1 to theta2 (in degrees). theta2 is unwrapped to produce the shortest arc within 360 degrees. That is, if theta2 > theta1 + 360, the arc will be from theta1 to theta2 - 360 and not a full circle plus some extra overlap. If n is provided, it is the number of spline segments to make. If n is not provided, the number of spline segments is determined based on the delta between theta1 and theta2. Masionobe, L. 2003. Drawing an elliptical arc using polylines, quadratic or cubic Bezier curves.
classmethodcircle(center=(0.0, 0.0), radius=1.0, readonly=False)[source]
Return a Path representing a circle of a given radius and center. Parameters
center(float, float), default: (0, 0)
The center of the circle.
radiusfloat, default: 1
The radius of the circle.
readonlybool
Whether the created path should have the "readonly" argument set when creating the Path instance. Notes The circle is approximated using 8 cubic Bezier curves, as described in Lancaster, Don. Approximating a Circle or an Ellipse Using Four Bezier Cubic Splines.
cleaned(transform=None, remove_nans=False, clip=None, *, simplify=False, curves=False, stroke_width=1.0, snap=False, sketch=None)[source]
Return a new Path with vertices and codes cleaned according to the parameters. See also Path.iter_segments
for details of the keyword arguments.
clip_to_bbox(bbox, inside=True)[source]
Clip the path to the given bounding box. The path must be made up of one or more closed polygons. This algorithm will not behave correctly for unclosed paths. If inside is True, clip to the inside of the box, otherwise to the outside of the box.
code_type
alias of numpy.uint8
propertycodes
The list of codes in the Path as a 1D numpy array. Each code is one of STOP, MOVETO, LINETO, CURVE3, CURVE4 or CLOSEPOLY. For codes that correspond to more than one vertex (CURVE3 and CURVE4), that code will be repeated so that the length of self.vertices and self.codes is always the same.
contains_path(path, transform=None)[source]
Return whether this (closed) path completely contains the given path. If transform is not None, the path will be transformed before checking for containment.
contains_point(point, transform=None, radius=0.0)[source]
Return whether the area enclosed by the path contains the given point. The path is always treated as closed; i.e. if the last code is not CLOSEPOLY an implicit segment connecting the last vertex to the first vertex is assumed. Parameters
point(float, float)
The point (x, y) to check.
transformmatplotlib.transforms.Transform, optional
If not None, point will be compared to self transformed by transform; i.e. for a correct check, transform should transform the path into the coordinate system of point.
radiusfloat, default: 0
Add an 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, negative values shrink the area: Points on the imaginary line will be considered outside the area. Returns
bool
Notes The current algorithm has some limitations: The result is undefined for points exactly at the boundary (i.e. at the path shifted by radius/2). The result is undefined if there is no enclosed area, i.e. all vertices are on a straight line. If bounding lines start to cross each other due to radius shift, the result is not guaranteed to be correct.
contains_points(points, transform=None, radius=0.0)[source]
Return whether the area enclosed by the path contains the given points. The path is always treated as closed; i.e. if the last code is not CLOSEPOLY an implicit segment connecting the last vertex to the first vertex is assumed. Parameters
points(N, 2) array
The points to check. Columns contain x and y values.
transformmatplotlib.transforms.Transform, optional
If not None, points will be compared to self transformed by transform; i.e. for a correct check, transform should transform the path into the coordinate system of points.
radiusfloat, default: 0
Add an 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, negative values shrink the area: Points on the imaginary line will be considered outside the area. Returns
length-N bool array
Notes The current algorithm has some limitations: The result is undefined for points exactly at the boundary (i.e. at the path shifted by radius/2). The result is undefined if there is no enclosed area, i.e. all vertices are on a straight line. If bounding lines start to cross each other due to radius shift, the result is not guaranteed to be correct.
copy()[source]
Return a shallow copy of the Path, which will share the vertices and codes with the source Path.
deepcopy(memo=None)[source]
Return a deepcopy of the Path. The Path will not be readonly, even if the source Path is.
get_extents(transform=None, **kwargs)[source]
Get Bbox of the path. Parameters
transformmatplotlib.transforms.Transform, optional
Transform to apply to path before computing extents, if any. **kwargs
Forwarded to iter_bezier. Returns
matplotlib.transforms.Bbox
The extents of the path Bbox([[xmin, ymin], [xmax, ymax]])
statichatch(hatchpattern, density=6)[source]
Given a hatch specifier, hatchpattern, generates a Path that can be used in a repeated hatching pattern. density is the number of lines per unit square.
interpolated(steps)[source]
Return a new path resampled to length N x steps. Codes other than LINETO are not handled correctly.
intersects_bbox(bbox, filled=True)[source]
Return whether this path intersects a given Bbox. If filled is True, then this also returns True if the path completely encloses the Bbox (i.e., the path is treated as filled). The bounding box is always considered filled.
intersects_path(other, filled=True)[source]
Return whether if this path intersects another given path. If filled is True, then this also returns True if one path completely encloses the other (i.e., the paths are treated as filled).
iter_bezier(**kwargs)[source]
Iterate over each bezier curve (lines included) in a Path. Parameters
**kwargs
Forwarded to iter_segments. Yields
Bmatplotlib.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).
codePath.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). Path.CLOSEPOLY is a Path.LINETO with the control points correctly chosen based on the start/end points of the current stroke.
iter_segments(transform=None, remove_nans=True, clip=None, snap=False, stroke_width=1.0, simplify=None, curves=True, sketch=None)[source]
Iterate over all curve segments in the path. Each iteration returns a pair (vertices, code), where vertices is a sequence of 1-3 coordinate pairs, and code is a Path code. Additionally, this method can provide a number of standard cleanups and conversions to the path. Parameters
transformNone or Transform
If not None, the given affine transformation will be applied to the path.
remove_nansbool, optional
Whether to remove all NaNs from the path and skip over them using MOVETO commands.
clipNone or (float, float, float, float), optional
If not None, must be a four-tuple (x1, y1, x2, y2) defining a rectangle in which to clip the path.
snapNone or bool, optional
If True, snap all nodes to pixels; if False, don't snap them. If None, snap if the path contains only segments parallel to the x or y axes, and no more than 1024 of them.
stroke_widthfloat, optional
The width of the stroke being drawn (used for path snapping).
simplifyNone or bool, optional
Whether to simplify the path by removing vertices that do not affect its appearance. If None, use the should_simplify attribute. See also rcParams["path.simplify"] (default: True) and rcParams["path.simplify_threshold"] (default: 0.111111111111).
curvesbool, optional
If True, curve segments will be returned as curve segments. If False, all curves will be converted to line segments.
sketchNone or sequence, optional
If not None, must be a 3-tuple of the form (scale, length, randomness), representing the sketch parameters.
classmethodmake_compound_path(*args)[source]
Make a compound path from a list of Path objects. Blindly removes all Path.STOP control points.
classmethodmake_compound_path_from_polys(XY)[source]
Make a compound path object to draw a number of polygons with equal numbers of sides XY is a (numpolys x numsides x 2) numpy array of vertices. Return object is a Path. (Source code, png, pdf)
propertyreadonly
True if the Path is read-only.
propertyshould_simplify
True if the vertices array should be simplified.
propertysimplify_threshold
The fraction of a pixel difference below which vertices will be simplified out.
to_polygons(transform=None, width=0, height=0, closed_only=True)[source]
Convert this path to a list of polygons or polylines. Each 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. If width and height are both non-zero then the lines will be simplified so that vertices outside of (0, 0), (width, height) will be clipped. If closed_only is True (default), only closed polygons, with the last point being the same as the first point, will be returned. Any unclosed polylines in the path will be explicitly closed. If closed_only is False, any unclosed polygons in the path will be returned as unclosed polygons, and the closed polygons will be returned explicitly closed by setting the last point to the same as the first point.
transformed(transform)[source]
Return a transformed copy of the path. See also matplotlib.transforms.TransformedPath
A specialized path class that will cache the transformed result and automatically update when the transform changes.
classmethodunit_circle()[source]
Return the readonly Path of the unit circle. For most cases, Path.circle() will be what you want.
classmethodunit_circle_righthalf()[source]
Return a Path of the right half of a unit circle. See Path.circle for the reference on the approximation used.
classmethodunit_rectangle()[source]
Return a Path instance of the unit rectangle from (0, 0) to (1, 1).
classmethodunit_regular_asterisk(numVertices)[source]
Return a Path for a unit regular asterisk with the given numVertices and radius of 1.0, centered at (0, 0).
classmethodunit_regular_polygon(numVertices)[source]
Return a Path instance for a unit regular polygon with the given numVertices such that the circumscribing circle has radius 1.0, centered at (0, 0).
classmethodunit_regular_star(numVertices, innerCircle=0.5)[source]
Return a Path for a unit regular star with the given numVertices and radius of 1.0, centered at (0, 0).
propertyvertices
The list of vertices in the Path as an Nx2 numpy array.
classmethodwedge(theta1, theta2, n=None)[source]
Return a Path for the unit circle wedge from angles theta1 to theta2 (in degrees). theta2 is unwrapped to produce the shortest wedge within 360 degrees. That is, if theta2 > theta1 + 360, the wedge will be from theta1 to theta2 - 360 and not a full circle plus some extra overlap. If n is provided, it is the number of spline segments to make. If n is not provided, the number of spline segments is determined based on the delta between theta1 and theta2. See Path.arc for the reference on the approximation used.
|
matplotlib.path_api#matplotlib.path.Path
|
classmethodarc(theta1, theta2, n=None, is_wedge=False)[source]
Return a Path for the unit circle arc from angles theta1 to theta2 (in degrees). theta2 is unwrapped to produce the shortest arc within 360 degrees. That is, if theta2 > theta1 + 360, the arc will be from theta1 to theta2 - 360 and not a full circle plus some extra overlap. If n is provided, it is the number of spline segments to make. If n is not provided, the number of spline segments is determined based on the delta between theta1 and theta2. Masionobe, L. 2003. Drawing an elliptical arc using polylines, quadratic or cubic Bezier curves.
|
matplotlib.path_api#matplotlib.path.Path.arc
|
classmethodcircle(center=(0.0, 0.0), radius=1.0, readonly=False)[source]
Return a Path representing a circle of a given radius and center. Parameters
center(float, float), default: (0, 0)
The center of the circle.
radiusfloat, default: 1
The radius of the circle.
readonlybool
Whether the created path should have the "readonly" argument set when creating the Path instance. Notes The circle is approximated using 8 cubic Bezier curves, as described in Lancaster, Don. Approximating a Circle or an Ellipse Using Four Bezier Cubic Splines.
|
matplotlib.path_api#matplotlib.path.Path.circle
|
cleaned(transform=None, remove_nans=False, clip=None, *, simplify=False, curves=False, stroke_width=1.0, snap=False, sketch=None)[source]
Return a new Path with vertices and codes cleaned according to the parameters. See also Path.iter_segments
for details of the keyword arguments.
|
matplotlib.path_api#matplotlib.path.Path.cleaned
|
clip_to_bbox(bbox, inside=True)[source]
Clip the path to the given bounding box. The path must be made up of one or more closed polygons. This algorithm will not behave correctly for unclosed paths. If inside is True, clip to the inside of the box, otherwise to the outside of the box.
|
matplotlib.path_api#matplotlib.path.Path.clip_to_bbox
|
CLOSEPOLY=79
|
matplotlib.path_api#matplotlib.path.Path.CLOSEPOLY
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.