Matplotlib is an amazing visualization library in Python for 2D plots of arrays. Matplotlib is a multi-platform data visualization library built on NumPy arrays and designed to work with the broader SciPy stack.
matplottlib.patches.ConnectionPatch a subclass of
matplotlib.patches.FancyArrowPatch class and are used for making connecting lines between two points.
Syntax: class matplotlib.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)
- xyA: It is the start point of connecting line on x-y plot also called Point A.
- xyB: It is the start point of connecting line on x-y plot also called Point B.
- coordsA: Coordinate of point A.
- coordsB: Coordinate of point B.
- axesA: It is the start point of connecting axes on x-y plot.
- axesB: It is the end point of connecting axes on x-y plot.
- arrowstyle: It is used for styling the connection arrow. Its default type is ‘-‘.
- arrow_transmuter: It is used to ignore a connecting line.
- connectionstyle: It describes how posA and posB are connected. It can be an instance of the class ConnectionStyle or a string by the name of connectionstyle, it has optional comma-separated attributes.
- connector: It is generally ignored and decides which connector to ignore.
- patchA: Used to add patches at point A.
- patchB: Used to add patches at point B
- shrinkA: Used to shrink the connector at point A.
- shrinkB: Used to shrink the connector at point B.
- mutation_scale: Value with which attributes of arrowstyle (e.g., head_length) gets scaled.
- mutation_aspect: The height of the rectangle will be squeezed by this value before the mutation and the mutated box will be stretched by the inverse of it.
- clip_on: Set whether the artist uses clipping.
- dpi_cor: dpi_cor is currently used for linewidth-related things and shrink factor. Mutation scale is affected by this.
The below are list of valid Kwargs key;
|arrowstyle||the arrow style|
|connectionstyle||the connection style|
|relpos||default is (0.5, 0.5)|
|patchA||default is bounding box of the text|
|patchB||default is None|
|shrinkA||default is 2 points|
|shrinkB||default is 2 points|
|mutation_scale||default is text size (in points)|
|mutation_aspect||default is 1.|
|?||any key for
The coordinates of xyA and xyB are indicated by a string coordsA and coordsB.
|‘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, 0 is lower left of axes and 1, 1 is upper right|
|‘data’||use the coordinate system of the object being annotated (default)|
|‘offset points’||offset (in points) from the xy value|
|‘polar’||you can specify theta, r for the annotation, even in cartesian plots. Note that if you are using a polar axes, you do not need to specify polar for the coordinate system since that is the native “data” coordinate system.|
- Inner Class in Python
- self in Python class
- Inheritance in Python Inner Class
- First Class functions in Python
- Class as decorator in python
- Wrapper Class in Python
- Extend Class Method in Python
- How to create an empty class in Python?
- Print objects of a class in Python
- Changing Class Members in Python
- Python Bokeh - Colors Class
- String Template Class in Python
- How to Get a List of Class Attributes in Python?
- Class and Instance Attributes in Python
- Class or Static Variables in Python
- Calling a Super Class Constructor in Python
- Matplotlib.colors.Normalize class in Python
- Matplotlib.colors.LinearSegmentedColormap class in Python
- Matplotlib.patches.Arrow Class in Python
- Matplotlib.ticker.IndexFormatter class in Python