matplotlib.patches.ArrowStyle

class matplotlib.patches.ArrowStyle(stylename, **kw)[source]

Bases: matplotlib.patches._Style

ArrowStyle is a container class which defines several arrowstyle classes, which is used to create an arrow path along a given path. These are mainly used with FancyArrowPatch.

A arrowstyle object can be either created as:

ArrowStyle.Fancy(head_length=.4, head_width=.4, tail_width=.4)

or:

ArrowStyle("Fancy", head_length=.4, head_width=.4, tail_width=.4)

or:

ArrowStyle("Fancy, head_length=.4, head_width=.4, tail_width=.4")

The following classes are defined

Class Name Attrs
Curve - None
CurveB -> head_length=0.4, head_width=0.2
BracketB -[ widthB=1.0, lengthB=0.2, angleB=None
CurveFilledB -|> head_length=0.4, head_width=0.2
CurveA <- head_length=0.4, head_width=0.2
CurveAB <-> head_length=0.4, head_width=0.2
CurveFilledA <|- head_length=0.4, head_width=0.2
CurveFilledAB <|-|> head_length=0.4, head_width=0.2
BracketA ]- widthA=1.0, lengthA=0.2, angleA=None
BracketAB ]-[ widthA=1.0, lengthA=0.2, angleA=None, widthB=1.0, lengthB=0.2, angleB=None
Fancy fancy head_length=0.4, head_width=0.4, tail_width=0.4
Simple simple head_length=0.5, head_width=0.5, tail_width=0.2
Wedge wedge tail_width=0.3, shrink_factor=0.5
BarAB |-| widthA=1.0, angleA=None, widthB=1.0, angleB=None

An instance of any arrow style class is a callable object, whose call signature is:

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

and it returns a tuple of a Path instance and a boolean value. path is a Path instance along which the arrow will be drawn. mutation_size and aspect_ratio have the same meaning as in BoxStyle. linewidth is a line width to be stroked. This is meant to be used to correct the location of the head so that it does not overshoot the destination point, but not all classes support it.

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

class BarAB(widthA=1.0, angleA=None, widthB=1.0, angleB=None)[source]

Bases: matplotlib.patches.ArrowStyle._Bracket

An arrow with vertical bars | at both ends.

Parameters:
widthAfloat, default: 1.0

Width of the bracket.

angleAfloat, default: None

Angle between the bracket and the line.

widthBfloat, default: 1.0

Width of the bracket.

angleBfloat, default: None

Angle between the bracket and the line.

__init__(widthA=1.0, angleA=None, widthB=1.0, angleB=None)[source]
Parameters:
widthAfloat, default: 1.0

Width of the bracket.

angleAfloat, default: None

Angle between the bracket and the line.

widthBfloat, default: 1.0

Width of the bracket.

angleBfloat, default: None

Angle between the bracket and the line.

__module__ = 'matplotlib.patches'
class BracketA(widthA=1.0, lengthA=0.2, angleA=None)[source]

Bases: matplotlib.patches.ArrowStyle._Bracket

An arrow with an outward square bracket at its start.

Parameters:
widthAfloat, default: 1.0

Width of the bracket.

lengthAfloat, default: 0.2

Length of the bracket.

angleAfloat, default: None

Angle between the bracket and the line.

__init__(widthA=1.0, lengthA=0.2, angleA=None)[source]
Parameters:
widthAfloat, default: 1.0

Width of the bracket.

lengthAfloat, default: 0.2

Length of the bracket.

angleAfloat, default: None

Angle between the bracket and the line.

__module__ = 'matplotlib.patches'
class BracketAB(widthA=1.0, lengthA=0.2, angleA=None, widthB=1.0, lengthB=0.2, angleB=None)[source]

Bases: matplotlib.patches.ArrowStyle._Bracket

An arrow with outward square brackets at both ends.

Parameters:
widthAfloat, default: 1.0

Width of the bracket.

lengthAfloat, default: 0.2

Length of the bracket.

angleAfloat, default: None

Angle between the bracket and the line.

widthBfloat, default: 1.0

Width of the bracket.

lengthBfloat, default: 0.2

Length of the bracket.

angleBfloat, default: None

Angle between the bracket and the line.

__init__(widthA=1.0, lengthA=0.2, angleA=None, widthB=1.0, lengthB=0.2, angleB=None)[source]
Parameters:
widthAfloat, default: 1.0

Width of the bracket.

lengthAfloat, default: 0.2

Length of the bracket.

angleAfloat, default: None

Angle between the bracket and the line.

widthBfloat, default: 1.0

Width of the bracket.

lengthBfloat, default: 0.2

Length of the bracket.

angleBfloat, default: None

Angle between the bracket and the line.

__module__ = 'matplotlib.patches'
class BracketB(widthB=1.0, lengthB=0.2, angleB=None)[source]

Bases: matplotlib.patches.ArrowStyle._Bracket

An arrow with an outward square bracket at its end.

Parameters:
widthBfloat, default: 1.0

Width of the bracket.

lengthBfloat, default: 0.2

Length of the bracket.

angleBfloat, default: None

Angle between the bracket and the line.

__init__(widthB=1.0, lengthB=0.2, angleB=None)[source]
Parameters:
widthBfloat, default: 1.0

Width of the bracket.

lengthBfloat, default: 0.2

Length of the bracket.

angleBfloat, default: None

Angle between the bracket and the line.

__module__ = 'matplotlib.patches'
class Curve[source]

Bases: matplotlib.patches.ArrowStyle._Curve

A simple curve without any arrow head.

The arrows are drawn if beginarrow and/or endarrow are true. head_length and head_width determines the size of the arrow relative to the mutation scale. The arrowhead at the begin (or end) is closed if fillbegin (or fillend) is True.

__init__()[source]

The arrows are drawn if beginarrow and/or endarrow are true. head_length and head_width determines the size of the arrow relative to the mutation scale. The arrowhead at the begin (or end) is closed if fillbegin (or fillend) is True.

__module__ = 'matplotlib.patches'
class CurveA(head_length=0.4, head_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Curve

An arrow with a head at its begin point.

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__init__(head_length=0.4, head_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__module__ = 'matplotlib.patches'
class CurveAB(head_length=0.4, head_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Curve

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

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__init__(head_length=0.4, head_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__module__ = 'matplotlib.patches'
class CurveB(head_length=0.4, head_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Curve

An arrow with a head at its end point.

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__init__(head_length=0.4, head_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__module__ = 'matplotlib.patches'
class CurveFilledA(head_length=0.4, head_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Curve

An arrow with filled triangle head at the begin.

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__init__(head_length=0.4, head_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__module__ = 'matplotlib.patches'
class CurveFilledAB(head_length=0.4, head_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Curve

An arrow with filled triangle heads at both ends.

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__init__(head_length=0.4, head_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__module__ = 'matplotlib.patches'
class CurveFilledB(head_length=0.4, head_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Curve

An arrow with filled triangle head at the end.

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__init__(head_length=0.4, head_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.2

Width of the arrow head.

__module__ = 'matplotlib.patches'
class Fancy(head_length=0.4, head_width=0.4, tail_width=0.4)[source]

Bases: matplotlib.patches.ArrowStyle._Base

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

Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.4

Width of the arrow head.

tail_widthfloat, default: 0.4

Width of the arrow tail.

__init__(head_length=0.4, head_width=0.4, tail_width=0.4)[source]
Parameters:
head_lengthfloat, default: 0.4

Length of the arrow head.

head_widthfloat, default: 0.4

Width of the arrow head.

tail_widthfloat, default: 0.4

Width of the arrow tail.

__module__ = 'matplotlib.patches'
transmute(path, mutation_size, linewidth)[source]

The transmute method is the very core of the ArrowStyle class and must be overridden in the subclasses. It receives the path object along which the arrow will be drawn, and the mutation_size, with which the arrow head etc. will be scaled. The linewidth may be used to adjust the path so that it does not pass beyond the given points. It returns a tuple of a Path instance and a boolean. The boolean value indicate whether the path can be filled or not. The return value can also be a list of paths and list of booleans of a same length.

class Simple(head_length=0.5, head_width=0.5, tail_width=0.2)[source]

Bases: matplotlib.patches.ArrowStyle._Base

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

Parameters:
head_lengthfloat, default: 0.5

Length of the arrow head.

head_widthfloat, default: 0.5

Width of the arrow head.

tail_widthfloat, default: 0.2

Width of the arrow tail.

__init__(head_length=0.5, head_width=0.5, tail_width=0.2)[source]
Parameters:
head_lengthfloat, default: 0.5

Length of the arrow head.

head_widthfloat, default: 0.5

Width of the arrow head.

tail_widthfloat, default: 0.2

Width of the arrow tail.

__module__ = 'matplotlib.patches'
transmute(path, mutation_size, linewidth)[source]

The transmute method is the very core of the ArrowStyle class and must be overridden in the subclasses. It receives the path object along which the arrow will be drawn, and the mutation_size, with which the arrow head etc. will be scaled. The linewidth may be used to adjust the path so that it does not pass beyond the given points. It returns a tuple of a Path instance and a boolean. The boolean value indicate whether the path can be filled or not. The return value can also be a list of paths and list of booleans of a same length.

class Wedge(tail_width=0.3, shrink_factor=0.5)[source]

Bases: matplotlib.patches.ArrowStyle._Base

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

Parameters:
tail_widthfloat, default: 0.3

Width of the tail.

shrink_factorfloat, default: 0.5

Fraction of the arrow width at the middle point.

__init__(tail_width=0.3, shrink_factor=0.5)[source]
Parameters:
tail_widthfloat, default: 0.3

Width of the tail.

shrink_factorfloat, default: 0.5

Fraction of the arrow width at the middle point.

__module__ = 'matplotlib.patches'
transmute(path, mutation_size, linewidth)[source]

The transmute method is the very core of the ArrowStyle class and must be overridden in the subclasses. It receives the path object along which the arrow will be drawn, and the mutation_size, with which the arrow head etc. will be scaled. The linewidth may be used to adjust the path so that it does not pass beyond the given points. It returns a tuple of a Path instance and a boolean. The boolean value indicate whether the path can be filled or not. The return value can also be a list of paths and list of booleans of a same length.

__module__ = 'matplotlib.patches'

Examples using matplotlib.patches.ArrowStyle