matplotlib.patches.ConnectionStyle

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

Bases: matplotlib.patches._Style

ConnectionStyle is a container class which defines several connectionstyle classes, which is used to create a path between two points. These are mainly used with FancyArrowPatch.

A connectionstyle object can be either created as:

ConnectionStyle.Arc3(rad=0.2)

or:

ConnectionStyle("Arc3", rad=0.2)

or:

ConnectionStyle("Arc3, rad=0.2")

The following classes are defined

Class Name Attrs
Angle angle angleA=90, angleB=0, rad=0.0
Angle3 angle3 angleA=90, angleB=0
Arc arc angleA=0, angleB=0, armA=None, armB=None, rad=0.0
Arc3 arc3 rad=0.0
Bar bar armA=0.0, armB=0.0, fraction=0.3, angle=None

An instance of any connection style class is an callable object, whose call signature is:

__call__(self, posA, posB,
         patchA=None, patchB=None,
         shrinkA=2., shrinkB=2.)

and it returns a Path instance. posA and posB are tuples of (x, y) coordinates of the two points to be connected. patchA (or patchB) is given, the returned path is clipped so that it start (or end) from the boundary of the patch. The path is further shrunk by shrinkA (or shrinkB) which is given in points.

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

class Angle(angleA=90, angleB=0, rad=0.0)[source]

Bases: matplotlib.patches.ConnectionStyle._Base

Creates a piecewise continuous quadratic Bezier path between two points. The path has a one passing-through point placed at the intersecting point of two lines which cross the start and end point, and have a slope of angleA and angleB, respectively. The connecting edges are rounded with rad.

angleA
starting angle of the path
angleB
ending angle of the path
rad
rounding radius of the edge
__init__(angleA=90, angleB=0, rad=0.0)[source]
angleA
starting angle of the path
angleB
ending angle of the path
rad
rounding radius of the edge
__module__ = 'matplotlib.patches'
connect(posA, posB)[source]
class Angle3(angleA=90, angleB=0)[source]

Bases: matplotlib.patches.ConnectionStyle._Base

Creates a simple quadratic Bezier curve between two points. The middle control points is placed at the intersecting point of two lines which cross the start and end point, and have a slope of angleA and angleB, respectively.

angleA
starting angle of the path
angleB
ending angle of the path
__init__(angleA=90, angleB=0)[source]
angleA
starting angle of the path
angleB
ending angle of the path
__module__ = 'matplotlib.patches'
connect(posA, posB)[source]
class Arc(angleA=0, angleB=0, armA=None, armB=None, rad=0.0)[source]

Bases: matplotlib.patches.ConnectionStyle._Base

Creates a piecewise continuous quadratic Bezier path between two points. The path can have two passing-through points, a point placed at the distance of armA and angle of angleA from point A, another point with respect to point B. The edges are rounded with rad.

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
__init__(angleA=0, angleB=0, armA=None, armB=None, rad=0.0)[source]
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
__module__ = 'matplotlib.patches'
connect(posA, posB)[source]
class Arc3(rad=0.0)[source]

Bases: matplotlib.patches.ConnectionStyle._Base

Creates a simple quadratic Bezier curve between two points. The curve is created so that the middle control point (C1) is located at the same distance from the start (C0) and end points(C2) and the distance of the C1 to the line connecting C0-C2 is rad times the distance of C0-C2.

rad
curvature of the curve.
__init__(rad=0.0)[source]
rad
curvature of the curve.
__module__ = 'matplotlib.patches'
connect(posA, posB)[source]
class Bar(armA=0.0, armB=0.0, fraction=0.3, angle=None)[source]

Bases: matplotlib.patches.ConnectionStyle._Base

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

Parameters:
armAfloat

minimum length of armA

armBfloat

minimum length of armB

fractionfloat

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

anglefloat or None

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

__init__(armA=0.0, armB=0.0, fraction=0.3, angle=None)[source]
Parameters:
armAfloat

minimum length of armA

armBfloat

minimum length of armB

fractionfloat

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

anglefloat or None

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

__module__ = 'matplotlib.patches'
connect(posA, posB)[source]
__module__ = 'matplotlib.patches'

Examples using matplotlib.patches.ConnectionStyle