Movatterモバイル変換


[0]ホーム

URL:


You are reading an old version of the documentation (v2.0.0). For the latest version seehttps://matplotlib.org/stable/api/patches_api.html
matplotlib

Navigation


Travis-CI:

Table Of Contents

Related Topics

This Page

Quick search

patches

matplotlib.patches

classmatplotlib.patches.Arc(xy,width,height,angle=0.0,theta1=0.0,theta2=360.0,**kwargs)

Bases:matplotlib.patches.Ellipse

An elliptical arc. Because it performs various optimizations, itcan not be filled.

The arc must be used in anAxesinstance—it can not be added directly to aFigure—because it is optimized toonly render the segments that are inside the axes bounding boxwith high resolution.

The following args are supported:

xy
center of ellipse
width
length of horizontal axis
height
length of vertical axis
angle
rotation in degrees (anti-clockwise)
theta1
starting angle of the arc in degrees
theta2
ending angle of the arc in degrees

Iftheta1 andtheta2 are not provided, the arc will form acomplete ellipse.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
draw(artist,renderer,*args,**kwargs)

Ellipses are normally drawn using an approximation that useseight cubic bezier splines. The error of this approximationis 1.89818e-6, according to this unverified source:

Lancaster, Don. Approximating a Circle or an Ellipse UsingFour Bezier Cubic Splines.

http://www.tinaja.com/glib/ellipse4.pdf

There is a use case where very large ellipses must be drawnwith very high accuracy, and it is too expensive to render theentire ellipse with enough segments (either splines or linesegments). Therefore, in the case where either radius of theellipse is large enough that the error of the splineapproximation will be visible (greater than one pixel offsetfrom 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:

  1. The points where the ellipse intersects the axes boundingbox are located. (This is done be performing an inversetransformation on the axes bbox such that it is relativeto the unit circle – this makes the intersectioncalculation much easier than doing rotated ellipseintersection directly).

    This uses the “line intersecting a circle” algorithmfrom:

    Vince, John. Geometry for Computer Graphics: Formulae,Examples & Proofs. London: Springer-Verlag, 2005.

  2. The angles of each of the intersection points arecalculated.

  3. Proceeding counterclockwise starting in the positivex-direction, each of the visible arc-segments between thepairs of vertices are drawn using the bezier arcapproximation technique implemented inmatplotlib.path.Path.arc().

classmatplotlib.patches.Arrow(x,y,dx,dy,width=1.0,**kwargs)

Bases:matplotlib.patches.Patch

An arrow patch.

Draws an arrow, starting at (x,y), direction and lengthgiven by (dx,dy) the width of the arrow is scaled bywidth.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_patch_transform()
get_path()
classmatplotlib.patches.ArrowStyle

Bases:matplotlib.patches._Style

ArrowStyle is a container class which defines severalarrowstyle classes, which is used to create an arrow path along agiven path. These are mainly used withFancyArrowPatch.

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

ClassNameAttrs
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
Fancyfancyhead_length=0.4,head_width=0.4,tail_width=0.4
Simplesimplehead_length=0.5,head_width=0.5,tail_width=0.2
Wedgewedgetail_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 a callable object,whose call signature is:

__call__(self,path,mutation_size,linewidth,aspect_ratio=1.)

and it returns a tuple of aPath instance and a booleanvalue.path is aPath instance along which the arrowwill be drawn.mutation_size andaspect_ratio have the samemeaning as inBoxStyle.linewidth is a line width to bestroked. This is meant to be used to correct the location of thehead so that it does not overshoot the destination point, but not allclasses support it.

(Source code,png,pdf)

../_images/fancyarrow_demo2.png

return the instance of the subclass with the given style name.

classBarAB(widthA=1.0,angleA=None,widthB=1.0,angleB=None)

Bases:matplotlib.patches._Bracket

An arrow with a bar(|) at both ends.

widthA
width of the bracket
lengthA
length of the bracket
angleA
angle between the bracket and the line
widthB
width of the bracket
lengthB
length of the bracket
angleB
angle between the bracket and the line
classArrowStyle.BracketA(widthA=1.0,lengthA=0.2,angleA=None)

Bases:matplotlib.patches._Bracket

An arrow with a bracket(]) at its end.

widthA
width of the bracket
lengthA
length of the bracket
angleA
angle between the bracket and the line
classArrowStyle.BracketAB(widthA=1.0,lengthA=0.2,angleA=None,widthB=1.0,lengthB=0.2,angleB=None)

Bases:matplotlib.patches._Bracket

An arrow with a bracket(]) at both ends.

widthA
width of the bracket
lengthA
length of the bracket
angleA
angle between the bracket and the line
widthB
width of the bracket
lengthB
length of the bracket
angleB
angle between the bracket and the line
classArrowStyle.BracketB(widthB=1.0,lengthB=0.2,angleB=None)

Bases:matplotlib.patches._Bracket

An arrow with a bracket([) at its end.

widthB
width of the bracket
lengthB
length of the bracket
angleB
angle between the bracket and the line
classArrowStyle.Curve

Bases:matplotlib.patches._Curve

A simple curve without any arrow head.

classArrowStyle.CurveA(head_length=0.4,head_width=0.2)

Bases:matplotlib.patches._Curve

An arrow with a head at its begin point.

head_length
length of the arrow head
head_width
width of the arrow head
classArrowStyle.CurveAB(head_length=0.4,head_width=0.2)

Bases:matplotlib.patches._Curve

An arrow with heads both at the begin and the end point.

head_length
length of the arrow head
head_width
width of the arrow head
classArrowStyle.CurveB(head_length=0.4,head_width=0.2)

Bases:matplotlib.patches._Curve

An arrow with a head at its end point.

head_length
length of the arrow head
head_width
width of the arrow head
classArrowStyle.CurveFilledA(head_length=0.4,head_width=0.2)

Bases:matplotlib.patches._Curve

An arrow with filled triangle head at the begin.

head_length
length of the arrow head
head_width
width of the arrow head
classArrowStyle.CurveFilledAB(head_length=0.4,head_width=0.2)

Bases:matplotlib.patches._Curve

An arrow with filled triangle heads both at the begin and the endpoint.

head_length
length of the arrow head
head_width
width of the arrow head
classArrowStyle.CurveFilledB(head_length=0.4,head_width=0.2)

Bases:matplotlib.patches._Curve

An arrow with filled triangle head at the end.

head_length
length of the arrow head
head_width
width of the arrow head
classArrowStyle.Fancy(head_length=0.4,head_width=0.4,tail_width=0.4)

Bases:matplotlib.patches._Base

A fancy arrow. Only works with a quadratic bezier curve.

head_length
length of the arrow head
head_with
width of the arrow head
tail_width
width of the arrow tail
transmute(path,mutation_size,linewidth)
classArrowStyle.Simple(head_length=0.5,head_width=0.5,tail_width=0.2)

Bases:matplotlib.patches._Base

A simple arrow. Only works with a quadratic bezier curve.

head_length
length of the arrow head
head_with
width of the arrow head
tail_width
width of the arrow tail
transmute(path,mutation_size,linewidth)
classArrowStyle.Wedge(tail_width=0.3,shrink_factor=0.5)

Bases:matplotlib.patches._Base

Wedge(?) shape. Only works with a quadratic bezier curve. Thebegin point has a width of the tail_width and the end point has awidth of 0. At the middle, the width is shrink_factor*tail_width.

tail_width
width of the tail
shrink_factor
fraction of the arrow width at the middle point
transmute(path,mutation_size,linewidth)
classmatplotlib.patches.BoxStyle

Bases:matplotlib.patches._Style

BoxStyle is a container class which defines severalboxstyle classes, which are used forFancyBboxPatch.

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.

ClassNameAttrs
Circlecirclepad=0.3
DArrowdarrowpad=0.3
LArrowlarrowpad=0.3
RArrowrarrowpad=0.3
Roundroundpad=0.3,rounding_size=None
Round4round4pad=0.3,rounding_size=None
Roundtoothroundtoothpad=0.3,tooth_size=None
Sawtoothsawtoothpad=0.3,tooth_size=None
Squaresquarepad=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 aPath instance.x0,y0,width andheight specify the location and size of the box to bedrawn.mutation_scale determines the overall size of themutation (by which I mean the transformation of the rectangle tothe fancy box).mutation_aspect determines the aspect-ratio ofthe mutation.

(Source code,png,pdf)

../_images/fancybox_demo22.png

return the instance of the subclass with the given style name.

classCircle(pad=0.3)

Bases:matplotlib.patches._Base

A simple circle box.

Parameters:

pad : float

The amount of padding around the original box.

transmute(x0,y0,width,height,mutation_size)
classBoxStyle.DArrow(pad=0.3)

Bases:matplotlib.patches._Base

(Double) Arrow Box

transmute(x0,y0,width,height,mutation_size)
classBoxStyle.LArrow(pad=0.3)

Bases:matplotlib.patches._Base

(left) Arrow Box

transmute(x0,y0,width,height,mutation_size)
classBoxStyle.RArrow(pad=0.3)

Bases:matplotlib.patches.LArrow

(right) Arrow Box

transmute(x0,y0,width,height,mutation_size)
classBoxStyle.Round(pad=0.3,rounding_size=None)

Bases:matplotlib.patches._Base

A box with round corners.

pad
amount of padding
rounding_size
rounding radius of corners.pad if None
transmute(x0,y0,width,height,mutation_size)
classBoxStyle.Round4(pad=0.3,rounding_size=None)

Bases:matplotlib.patches._Base

Another box with round edges.

pad
amount of padding
rounding_size
rounding size of edges.pad if None
transmute(x0,y0,width,height,mutation_size)
classBoxStyle.Roundtooth(pad=0.3,tooth_size=None)

Bases:matplotlib.patches.Sawtooth

A rounded tooth box.

pad
amount of padding
tooth_size
size of the sawtooth. pad* if None
transmute(x0,y0,width,height,mutation_size)
classBoxStyle.Sawtooth(pad=0.3,tooth_size=None)

Bases:matplotlib.patches._Base

A sawtooth box.

pad
amount of padding
tooth_size
size of the sawtooth. pad* if None
transmute(x0,y0,width,height,mutation_size)
classBoxStyle.Square(pad=0.3)

Bases:matplotlib.patches._Base

A simple square box.

pad
amount of padding
transmute(x0,y0,width,height,mutation_size)
classmatplotlib.patches.Circle(xy,radius=5,**kwargs)

Bases:matplotlib.patches.Ellipse

A circle patch.

Create true circle at centerxy = (x,y) with givenradius. UnlikeCirclePolygonwhich is a polygonal approximation, this uses Bézier splinesand is much closer to a scale-free circle.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_radius()

return the radius of the circle

radius

return the radius of the circle

set_radius(radius)

Set the radius of the circle

ACCEPTS: float

classmatplotlib.patches.CirclePolygon(xy,radius=5,resolution=20,**kwargs)

Bases:matplotlib.patches.RegularPolygon

A polygon-approximation of a circle patch.

Create a circle atxy = (x,y) with givenradius.This circle is approximated by a regular polygon withresolution sides. For a smoother circle drawn with splines,seeCircle.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
classmatplotlib.patches.ConnectionPatch(xyA,xyB,coordsA,coordsB=None,axesA=None,axesB=None,arrowstyle='-',arrow_transmuter=None,connectionstyle='arc3',connector=None,patchA=None,patchB=None,shrinkA=0.0,shrinkB=0.0,mutation_scale=10.0,mutation_aspect=None,clip_on=False,dpi_cor=1.0,**kwargs)

Bases:matplotlib.patches.FancyArrowPatch

AConnectionPatch class is to makeconnecting lines between two points (possibly in different axes).

Connect pointxyA incoordsA with pointxyB incoordsB

Valid keys are

KeyDescription
arrowstylethe arrow style
connectionstylethe connection style
relposdefault is (0.5, 0.5)
patchAdefault is bounding box of the text
patchBdefault is None
shrinkAdefault is 2 points
shrinkBdefault is 2 points
mutation_scaledefault is text size (in points)
mutation_aspectdefault is 1.
?any key formatplotlib.patches.PathPatch

coordsA andcoordsB are strings that indicate thecoordinates ofxyA andxyB.

PropertyDescription
‘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 beingannotated (default)
‘offset points’Specify an offset (in points) from thexy value
‘polar’you can specifytheta,r for the annotation,even in cartesian plots. Note that if youare using a polar axes, you do not needto specify polar for the coordinatesystem since that is the native “data” coordinatesystem.
draw(renderer)

Draw.

get_annotation_clip()

Returnannotation_clip attribute.Seeset_annotation_clip() for the meaning of return values.

get_path_in_displaycoord()

Return the mutated path of the arrow in the display coord

set_annotation_clip(b)

setannotation_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 ifxycoords is “data”
classmatplotlib.patches.ConnectionStyle

Bases:matplotlib.patches._Style

ConnectionStyle is a container class which definesseveral connectionstyle classes, which is used to create a pathbetween two points. These are mainly used withFancyArrowPatch.

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

ClassNameAttrs
AngleangleangleA=90,angleB=0,rad=0.0
Angle3angle3angleA=90,angleB=0
ArcarcangleA=0,angleB=0,armA=None,armB=None,rad=0.0
Arc3arc3rad=0.0
BarbararmA=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 aPath instance.posA andposB aretuples of x,y coordinates of the two points to beconnected.patchA (orpatchB) is given, the returned path isclipped so that it start (or end) from the boundary of thepatch. The path is further shrunk byshrinkA (orshrinkB)which is given in points.

return the instance of the subclass with the given style name.

classAngle(angleA=90,angleB=0,rad=0.0)

Bases:matplotlib.patches._Base

Creates a picewise continuous quadratic bezier path betweentwo points. The path has a one passing-through point placed atthe intersecting point of two lines which crosses the start(or end) point and has a angle of angleA (or angleB). Theconnecting edges are rounded withrad.

angleA
starting angle of the path
angleB
ending angle of the path
rad
rounding radius of the edge
connect(posA,posB)
classConnectionStyle.Angle3(angleA=90,angleB=0)

Bases:matplotlib.patches._Base

Creates a simple quadratic bezier curve between twopoints. The middle control points is placed at theintersecting point of two lines which crosses the start (orend) point and has a angle of angleA (or angleB).

angleA
starting angle of the path
angleB
ending angle of the path
connect(posA,posB)
classConnectionStyle.Arc(angleA=0,angleB=0,armA=None,armB=None,rad=0.0)

Bases:matplotlib.patches._Base

Creates a picewise continuous quadratic bezier path betweentwo points. The path can have two passing-through points, apoint placed at the distance of armA and angle of angleA frompoint A, another point with respect to point B. The edges arerounded withrad.

angleA :
starting angle of the path
angleB :
ending angle of the path
armA :
length of the starting arm
armB :
length of the ending arm
rad :
rounding radius of the edges
connect(posA,posB)
classConnectionStyle.Arc3(rad=0.0)

Bases:matplotlib.patches._Base

Creates a simple quadratic bezier curve between twopoints. The curve is created so that the middle contol points(C1) is located at the same distance from the start (C0) andend points(C2) and the distance of the C1 to the lineconnecting C0-C2 israd times the distance of C0-C2.

rad
curvature of the curve.
connect(posA,posB)
classConnectionStyle.Bar(armA=0.0,armB=0.0,fraction=0.3,angle=None)

Bases:matplotlib.patches._Base

A line withangle between A and B witharmA andarmB. One of the arms is extended so that they are connected ina right angle. The length of armA is determined by (armA+fraction x AB distance). Same for armB.

Parameters:

armA : float

minimum length of armA

armB : float

minimum length of armB

fraction : float

a fraction of the distance between two points thatwill be added to armA and armB.

angle : float or None

angle of the connecting line (if None, parallelto A and B)

connect(posA,posB)
classmatplotlib.patches.Ellipse(xy,width,height,angle=0.0,**kwargs)

Bases:matplotlib.patches.Patch

A scale-free ellipse.

xy
center of ellipse
width
total length (diameter) of horizontal axis
height
total length (diameter) of vertical axis
angle
rotation in degrees (anti-clockwise)

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_patch_transform()
get_path()

Return the vertices of the rectangle

classmatplotlib.patches.FancyArrow(x,y,dx,dy,width=0.001,length_includes_head=False,head_width=None,head_length=None,shape='full',overhang=0,head_starts_at_zero=False,**kwargs)

Bases:matplotlib.patches.Polygon

Like Arrow, but lets you set head width and head height independently.

Constructor arguments
width: float (default: 0.001)
width of full arrow tail
length_includes_head: [True | False] (default: False)
True if head is to be counted in calculating the length.
head_width: float or None (default: 3*width)
total width of the full arrow head
head_length: float or None (default: 1.5 * head_width)
length of arrow head
shape: [‘full’, ‘left’, ‘right’] (default: ‘full’)
draw the left-half, right-half, or full arrow
overhang: float (default: 0)
fraction that the arrow is swept back (0 overhang meanstriangular shape). Can be negative or greater than one.
head_starts_at_zero: [True | False] (default: False)
if True, the head starts being drawn at coordinate 0instead of ending at coordinate 0.

Other valid kwargs (inherited fromPatch) are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
classmatplotlib.patches.FancyArrowPatch(posA=None,posB=None,path=None,arrowstyle='simple',arrow_transmuter=None,connectionstyle='arc3',connector=None,patchA=None,patchB=None,shrinkA=2.0,shrinkB=2.0,mutation_scale=1.0,mutation_aspect=None,dpi_cor=1.0,**kwargs)

Bases:matplotlib.patches.Patch

A fancy arrow patch. It draws an arrow using the :class:ArrowStyle.

IfposA andposB is given, a path connecting two point arecreated according to the connectionstyle. The path will beclipped withpatchA andpatchB and further shrunken byshrinkA andshrinkB. An arrow is drawn along thisresulting path using thearrowstyle parameter. Ifpathprovided, an arrow is drawn along this path andpatchA,patchB,shrinkA, andshrinkB are ignored.

Theconnectionstyle describes howposA andposB areconnected. It can be an instance of the ConnectionStyle class(matplotlib.patches.ConnectionStlye) or a string of theconnectionstyle name, with optional comma-separatedattributes. The following connection styles are available.

ClassNameAttrs
AngleangleangleA=90,angleB=0,rad=0.0
Angle3angle3angleA=90,angleB=0
ArcarcangleA=0,angleB=0,armA=None,armB=None,rad=0.0
Arc3arc3rad=0.0
BarbararmA=0.0,armB=0.0,fraction=0.3,angle=None

Thearrowstyle describes how the fancy arrow will bedrawn. It can be string of the available arrowstyle names,with optional comma-separated attributes, or one of theArrowStyle instance. The optional attributes are meant to bescaled with themutation_scale. The following arrow styles areavailable.

ClassNameAttrs
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
Fancyfancyhead_length=0.4,head_width=0.4,tail_width=0.4
Simplesimplehead_length=0.5,head_width=0.5,tail_width=0.2
Wedgewedgetail_width=0.3,shrink_factor=0.5
BarAB|-|widthA=1.0,angleA=None,widthB=1.0,angleB=None
mutation_scale:a value with which attributes of arrowstyle
(e.g., head_length) will be scaled. default=1.
mutation_aspect:The height of the rectangle will be
squeezed by this value before the mutation and the mutatedbox will be stretched by the inverse of it. default=None.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
draw(renderer)
get_arrowstyle()

Return the arrowstyle object

get_connectionstyle()

Return the ConnectionStyle instance

get_dpi_cor()

dpi_cor is currently used for linewidth-related things andshrink factor. Mutation scale is affected by this.

get_mutation_aspect()

Return the aspect ratio of the bbox mutation.

get_mutation_scale()

Return the mutation scale.

get_path()

return the path of the arrow in the data coordinate. Useget_path_in_displaycoord() method to retrieve the arrow pathin the display coord.

get_path_in_displaycoord()

Return the mutated path of the arrow in the display coord

set_arrowstyle(arrowstyle=None,**kw)

Set the arrow style.

arrowstyle can be a string with arrowstyle name with optional

comma-separated attributes. Alternatively, the attrs canbe 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), returnavailable box styles as a list of strings.

set_connectionstyle(connectionstyle,**kw)

Set the connection style.

connectionstyle can be a string with connectionstyle name with

optional comma-separated attributes. Alternatively, the attrs can beprovided 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), returnavailable styles as a list of strings.

set_dpi_cor(dpi_cor)

dpi_cor is currently used for linewidth-related things andshrink factor. Mutation scale is affected by this.

set_mutation_aspect(aspect)

Set the aspect ratio of the bbox mutation.

ACCEPTS: float

set_mutation_scale(scale)

Set the mutation scale.

ACCEPTS: float

set_patchA(patchA)

set the begin patch.

set_patchB(patchB)

set the begin patch

set_positions(posA,posB)

set the begin and end positions of the connectingpath. Use current value if None.

classmatplotlib.patches.FancyBboxPatch(xy,width,height,boxstyle='round',bbox_transmuter=None,mutation_scale=1.0,mutation_aspect=None,**kwargs)

Bases:matplotlib.patches.Patch

Draw a fancy box around a rectangle with lower left atxy*=(*x,y) with specified width and height.

FancyBboxPatch class is similar toRectangleclass, but it draws a fancy box around the rectangle. Thetransformation of the rectangle box to the fancy box is delegatedto theBoxTransmuterBase and its derived classes.

xy = lower left corner

width,height

boxstyle determines what kind of fancy box will be drawn. Itcan be a string of the style name with a comma separatedattribute, or an instance ofBoxStyle. Following boxstyles are available.

ClassNameAttrs
Circlecirclepad=0.3
DArrowdarrowpad=0.3
LArrowlarrowpad=0.3
RArrowrarrowpad=0.3
Roundroundpad=0.3,rounding_size=None
Round4round4pad=0.3,rounding_size=None
Roundtoothroundtoothpad=0.3,tooth_size=None
Sawtoothsawtoothpad=0.3,tooth_size=None
Squaresquarepad=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 besqueezed by this value before the mutation and the mutatedbox will be stretched by the inverse of it. default=None.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_bbox()
get_boxstyle()

Return the boxstyle object

get_height()

Return the height of the rectangle

get_mutation_aspect()

Return the aspect ratio of the bbox mutation.

get_mutation_scale()

Return the mutation scale.

get_path()

Return the mutated path of the rectangle

get_width()

Return the width of the rectangle

get_x()

Return the left coord of the rectangle

get_y()

Return the bottom coord of the rectangle

set_bounds(*args)

Set the bounds of the rectangle: l,b,w,h

ACCEPTS: (left, bottom, width, height)

set_boxstyle(boxstyle=None,**kw)

Set the box style.

boxstyle can be a string with boxstyle name with optionalcomma-separated attributes. Alternatively, the attrs canbe provided as keywords:

set_boxstyle("round,pad=0.2")set_boxstyle("round",pad=0.2)

Old attrs simply are forgotten.

Without argument (or withboxstyle = None), it returnsavailable box styles.

The following boxstyles are available:

ClassNameAttrs
Circlecirclepad=0.3
DArrowdarrowpad=0.3
LArrowlarrowpad=0.3
RArrowrarrowpad=0.3
Roundroundpad=0.3,rounding_size=None
Round4round4pad=0.3,rounding_size=None
Roundtoothroundtoothpad=0.3,tooth_size=None
Sawtoothsawtoothpad=0.3,tooth_size=None
Squaresquarepad=0.3

ACCEPTS: [ ‘circle’ | ‘darrow’ | ‘larrow’ | ‘rarrow’ | ‘round’ | ‘round4’ | ‘roundtooth’ | ‘sawtooth’ | ‘square’ ]

set_height(h)

Set the width rectangle

ACCEPTS: float

set_mutation_aspect(aspect)

Set the aspect ratio of the bbox mutation.

ACCEPTS: float

set_mutation_scale(scale)

Set the mutation scale.

ACCEPTS: float

set_width(w)

Set the width rectangle

ACCEPTS: float

set_x(x)

Set the left coord of the rectangle

ACCEPTS: float

set_y(y)

Set the bottom coord of the rectangle

ACCEPTS: float

classmatplotlib.patches.Patch(edgecolor=None,facecolor=None,color=None,linewidth=None,linestyle=None,antialiased=None,hatch=None,fill=True,capstyle=None,joinstyle=None,**kwargs)

Bases:matplotlib.artist.Artist

A patch is a 2D artist with a face color and an edge color.

If any ofedgecolor,facecolor,linewidth, orantialiasedareNone, they default to their rc params setting.

The following kwarg properties are supported

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
contains(mouseevent,radius=None)

Test whether the mouse event occurred in the patch.

Returns T/F, {}

contains_point(point,radius=None)

ReturnsTrue if the given point is inside the path(transformed with its transform attribute).

draw(artist,renderer,*args,**kwargs)

Draw thePatch to the givenrenderer.

fill

return whether fill is set

get_aa()

Returns True if thePatch is to be drawn with antialiasing.

get_antialiased()

Returns True if thePatch is to be drawn with antialiasing.

get_capstyle()

Return the current capstyle

get_data_transform()

Return theTransform instance whichmaps data coordinates to physical coordinates.

get_ec()

Return the edge color of thePatch.

get_edgecolor()

Return the edge color of thePatch.

get_extents()

Return aBbox object definingthe axis-aligned extents of thePatch.

get_facecolor()

Return the face color of thePatch.

get_fc()

Return the face color of thePatch.

get_fill()

return whether fill is set

get_hatch()

Return the current hatching pattern

get_joinstyle()

Return the current joinstyle

get_linestyle()

Return the linestyle. Will be one of [‘solid’ | ‘dashed’ |‘dashdot’ | ‘dotted’]

get_linewidth()

Return the line width in points.

get_ls()

Return the linestyle. Will be one of [‘solid’ | ‘dashed’ |‘dashdot’ | ‘dotted’]

get_lw()

Return the line width in points.

get_patch_transform()

Return theTransform instance whichtakes patch coordinates to data coordinates.

For example, one may define a patch of a circle which represents aradius of 5 by providing coordinates for a unit circle, and atransform which scales the coordinates (the patch coordinate) by 5.

get_path()

Return the path of this patch

get_transform()

Return theTransform appliedto thePatch.

get_verts()

Return a copy of the vertices used in this patch

If the patch contains Bezier curves, the curves will beinterpolated by line segments. To access the curves ascurves, useget_path().

get_window_extent(renderer=None)
set_aa(aa)

alias for set_antialiased

set_alpha(alpha)

Set the alpha tranparency of the patch.

ACCEPTS: float or None

set_antialiased(aa)

Set whether to use antialiased rendering

ACCEPTS: [True | False] or None for default

set_capstyle(s)

Set the patch capstyle

ACCEPTS: [‘butt’ | ‘round’ | ‘projecting’]

set_color(c)

Set both the edgecolor and the facecolor.

ACCEPTS: matplotlib color spec

See also

set_facecolor(),set_edgecolor()
For setting the edge or face color individually.
set_ec(color)

alias for set_edgecolor

set_edgecolor(color)

Set the patch edge color

ACCEPTS: mpl color spec, None, ‘none’, or ‘auto’

set_facecolor(color)

Set the patch face color

ACCEPTS: mpl color spec, or None for default, or ‘none’ for no color

set_fc(color)

alias for set_facecolor

set_fill(b)

Set whether to fill the patch

ACCEPTS: [True | False]

set_hatch(hatch)

Set the hatching pattern

hatch can be one of:

/-diagonalhatching\-backdiagonal|-vertical--horizontal+-crossedx-crosseddiagonalo-smallcircleO-largecircle.-dots*-stars

Letters can be combined, in which case all the specifiedhatchings are done. If same letter repeats, it increases thedensity of hatching of that pattern.

Hatching is supported in the PostScript, PDF, SVG and Aggbackends only.

ACCEPTS: [‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]

set_joinstyle(s)

Set the patch joinstyle

ACCEPTS: [‘miter’ | ‘round’ | ‘bevel’]

set_linestyle(ls)

Set the patch linestyle

linestyledescription
'-' or'solid'solid line
'--' or'dashed'dashed line
'-.' or'dashdot'dash-dotted line
':' or'dotted'dotted line

Alternatively a dash tuple of the following form can be provided:

(offset,onoffseq),

whereonoffseq is an even length tuple of on and off inkin points.

ACCEPTS: [‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ |
(offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
Parameters:

ls : { ‘-‘, ‘–’, ‘-.’, ‘:’} and more see description

The line style.

set_linewidth(w)

Set the patch linewidth in points

ACCEPTS: float or None for default

set_ls(ls)

alias for set_linestyle

set_lw(lw)

alias for set_linewidth

update_from(other)

Updates thisPatch from the properties ofother.

validCap = ('butt', 'round', 'projecting')
validJoin = ('miter', 'round', 'bevel')
zorder = 1
classmatplotlib.patches.PathPatch(path,**kwargs)

Bases:matplotlib.patches.Patch

A general polycurve path patch.

path is amatplotlib.path.Path object.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number

See also

Patch
For additional kwargs
get_path()
classmatplotlib.patches.Polygon(xy,closed=True,**kwargs)

Bases:matplotlib.patches.Patch

A general polygon patch.

xy is a numpy array with shape Nx2.

Ifclosed isTrue, the polygon will be closed so thestarting and ending points are the same.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number

See also

Patch
For additional kwargs
get_closed()

Returns if the polygon is closed

Returns:

closed : bool

If the path is closed

get_path()

Get the path of the polygon

Returns:

path : Path

ThePath object forthe polygon

get_xy()

Get the vertices of the path

Returns:

vertices : numpy array

The coordinates of the vertices as a Nx2ndarray.

set_closed(closed)

Set if the polygon is closed

Parameters:

closed : bool

True if the polygon is closed

set_xy(xy)

Set the vertices of the polygon

Parameters:

xy : numpy array or iterable of pairs

The coordinates of the vertices as a Nx2ndarray or iterable of pairs.

xy

Set/get the vertices of the polygon. This property isprovided for backward compatibility with matplotlib 0.91.xonly. New code should useget_xy() andset_xy() instead.

classmatplotlib.patches.Rectangle(xy,width,height,angle=0.0,**kwargs)

Bases:matplotlib.patches.Patch

Draw a rectangle with lower left atxy = (x,y) withspecifiedwidth andheight.

angle
rotation in degrees (anti-clockwise)

fill is a boolean indicating whether to fill the rectangle

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_bbox()
get_height()

Return the height of the rectangle

get_patch_transform()
get_path()

Return the vertices of the rectangle

get_width()

Return the width of the rectangle

get_x()

Return the left coord of the rectangle

get_xy()

Return the left and bottom coords of the rectangle

get_y()

Return the bottom coord of the rectangle

set_bounds(*args)

Set the bounds of the rectangle: l,b,w,h

ACCEPTS: (left, bottom, width, height)

set_height(h)

Set the width rectangle

ACCEPTS: float

set_width(w)

Set the width rectangle

ACCEPTS: float

set_x(x)

Set the left coord of the rectangle

ACCEPTS: float

set_xy(xy)

Set the left and bottom coords of the rectangle

ACCEPTS: 2-item sequence

set_y(y)

Set the bottom coord of the rectangle

ACCEPTS: float

xy

Return the left and bottom coords of the rectangle

classmatplotlib.patches.RegularPolygon(xy,numVertices,radius=5,orientation=0,**kwargs)

Bases:matplotlib.patches.Patch

A regular polygon patch.

Constructor arguments:

xy
A length 2 tuple (x,y) of the center.
numVertices
the number of vertices.
radius
The distance from the center to each of the vertices.
orientation
rotates the polygon (in radians).

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_patch_transform()
get_path()
numvertices
orientation
radius
xy
classmatplotlib.patches.Shadow(patch,ox,oy,props=None,**kwargs)

Bases:matplotlib.patches.Patch

Create a shadow of the givenpatch offset byox,oy.props, if notNone, is a patch property update dictionary.IfNone, the shadow will have have the same color as the face,but darkened.

kwargs are

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
draw(renderer)
get_patch_transform()
get_path()
classmatplotlib.patches.Wedge(center,r,theta1,theta2,width=None,**kwargs)

Bases:matplotlib.patches.Patch

Wedge shaped patch.

Draw a wedge centered atx,y center with radiusr thatsweepstheta1 totheta2 (in degrees). Ifwidth is given,then a partial wedge is drawn from inner radiusr -widthto outer radiusr.

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_path()
set_center(center)
set_radius(radius)
set_theta1(theta1)
set_theta2(theta2)
set_width(width)
classmatplotlib.patches.YAArrow(figure,xytip,xybase,width=4,frac=0.1,headwidth=12,**kwargs)

Bases:matplotlib.patches.Patch

Yet another arrow class.

This is an arrow that is defined in display space and has a tip atx1,y1 and a base atx2,y2.

Constructor arguments:

xytip
(x,y) location of arrow tip
xybase
(x,y) location the arrow base mid point
figure
TheFigure instance(fig.dpi)
width
The width of the arrow in points
frac
The fraction of the arrow length occupied by the head
headwidth
The width of the base of the arrow head in points

Valid kwargs are:

PropertyDescription
agg_filterunknown
alphafloat or None
animated[True | False]
antialiased or aa[True | False] or None for default
axesanAxes instance
capstyle[‘butt’ | ‘round’ | ‘projecting’]
clip_boxamatplotlib.transforms.Bbox instance
clip_on[True | False]
clip_path[ (Path,Transform) |Patch | None ]
colormatplotlib color spec
containsa callable function
edgecolor or ecmpl color spec, None, ‘none’, or ‘auto’
facecolor or fcmpl color spec, or None for default, or ‘none’ for no color
figureamatplotlib.figure.Figure instance
fill[True | False]
gidan id string
hatch[‘/’ | ‘\’ | ‘|’ | ‘-‘ | ‘+’ | ‘x’ | ‘o’ | ‘O’ | ‘.’ | ‘*’]
joinstyle[‘miter’ | ‘round’ | ‘bevel’]
labelstring or anything printable with ‘%s’ conversion.
linestyle or ls[‘solid’ | ‘dashed’, ‘dashdot’, ‘dotted’ | (offset, on-off-dash-seq) |'-' |'--' |'-.' |':' |'None' |'' |'']
linewidth or lwfloat or None for default
path_effectsunknown
picker[None|float|boolean|callable]
rasterized[True | False | None]
sketch_paramsunknown
snapunknown
transformTransform instance
urla url string
visible[True | False]
zorderany number
get_patch_transform()
get_path()
getpoints(x1,y1,x2,y2,k)

For line segment defined by (x1,y1) and (x2,y2)return the points on the line that is perpendicular to theline and intersects (x2,y2) and the distance from (x2,y2) of the returned points isk.

matplotlib.patches.bbox_artist(artist,renderer,props=None,fill=True)

This is a debug function to draw a rectangle around the boundingbox returned byget_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.

matplotlib.patches.draw_bbox(bbox,renderer,color='k',trans=None)

This is a debug function to draw a rectangle around the boundingbox returned byget_window_extent() of an artist,to test whether the artist is returning the correct bbox.

© Copyright 2002 - 2012 John Hunter, Darren Dale, Eric Firing, Michael Droettboom and the Matplotlib development team; 2012 - 2016 The Matplotlib development team. Last updated on Feb 20, 2017. Created usingSphinx 1.5.2.

[8]ページ先頭

©2009-2025 Movatter.jp