Bases: matplotlib.transforms.Affine2DBase
A special class that does one thing, the identity transform, in a fast way.
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.
Return str(self).
Return a frozen copy of this transform node. The frozen copy will not be updated when its children change. Useful for storing a previously known state of a transform where copy.deepcopy() might normally be used.
Get the affine part of this transform.
Get the matrix for the affine part of this transform.
Return the corresponding inverse transformation.
It holds x == self.inverted().transform(self.transform(x)).
The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
Apply this transformation on the given array of values.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Apply only the affine part of this transformation on the given array of values.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally a no-op. In affine transformations, this is equivalent to transform(values).
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Apply only the non-affine part of this transformation.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Apply the transform to Path path, returning a new Path.
In some cases, this transform may insert curves into the path that began as line segments.
Apply the affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).
Apply the non-affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).


Return a frozen copy of this transform node. The frozen copy will not be updated when its children change. Useful for storing a previously known state of a transform where copy.deepcopy() might normally be used.


Get the matrix for the affine part of this transform.


Return the corresponding inverse transformation.
It holds x == self.inverted().transform(self.transform(x)).
The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.


Apply this transformation on the given array of values.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.


Apply only the affine part of this transformation on the given array of values.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally a no-op. In affine transformations, this is equivalent to transform(values).
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.


Apply only the non-affine part of this transformation.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.


Apply the transform to Path path, returning a new Path.
In some cases, this transform may insert curves into the path that began as line segments.


Apply the affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).


Apply the non-affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).


Check, inclusively, whether an interval includes a given value.
The endpoints of the interval.
Value to check is within interval.
Whether val is within the interval.


Check, excluding endpoints, whether an interval includes a given value.
The endpoints of the interval.
Value to check is within interval.
Whether val is within the interval.


Bases: matplotlib.transforms.BboxBase
A Bbox where some elements may be locked at certain values.
When the child bounding box changes, the bounds of this bbox will update accordingly with the exception of the locked elements.
The child bounding box to wrap.
The locked value for x0, or None to leave unlocked.
The locked value for y0, or None to leave unlocked.
The locked value for x1, or None to leave unlocked.
The locked value for y1, or None to leave unlocked.
The child bounding box to wrap.
The locked value for x0, or None to leave unlocked.
The locked value for y0, or None to leave unlocked.
The locked value for x1, or None to leave unlocked.
The locked value for y1, or None to leave unlocked.
Return str(self).
float or None: The value used for the locked x0.
float or None: The value used for the locked x1.
float or None: The value used for the locked y0.
float or None: The value used for the locked y1.


The child bounding box to wrap.
The locked value for x0, or None to leave unlocked.
The locked value for y0, or None to leave unlocked.
The locked value for x1, or None to leave unlocked.
The locked value for y1, or None to leave unlocked.


Modify the endpoints of a range as needed to avoid singularities.
The initial endpoints.
Fractional amount by which vmin and vmax are expanded if the original interval is too small, based on tiny.
Threshold for the ratio of the interval to the maximum absolute value of its endpoints. If the interval is smaller than this, it will be expanded. This value should be around 1e-15 or larger; otherwise the interval will be approaching the double precision resolution limit.
If True, swap vmin, vmax if vmin > vmax.
Endpoints, expanded and/or swapped if necessary. If either input is inf or NaN, or if both inputs are 0 or very close to zero, it returns -expander, expander.


Return a new transform with an added offset.
Any transform, to which offset will be applied.
Current figure. It can be None if units are 'dots'.
The offset to apply.
Units of the offset.
Transform with applied offset.


Bases: matplotlib.transforms.Affine2DBase
A transformation that translates by xt and yt, after xt and yt have been transformed by scale_trans.
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.
Return str(self).
Get the matrix for the affine part of this transform.


A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.


Bases: matplotlib.transforms.TransformNode
The base class of all TransformNode instances that actually perform a transformation.
All non-affine transformations should be subclasses of this class. New affine transformations should be subclasses of Affine2D.
Subclasses of this class should override the following members (at minimum):
The following attributes may be overridden if the default is unsuitable:
If the transform needs to do something non-standard with matplotlib.path.Path objects, such as adding curves where there were once line segments, it should override:
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.
Compose two transforms together so that self is followed by other.
A + B returns a transform C so that C.transform(x) == B.transform(A.transform(x)).
Array interface to get at this Transform's affine matrix.
This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.
Compose self with the inverse of other, cancelling identical terms if any:
Cancellation (rather than naively returning A + B.inverted()) is important for multiple reasons:
Return whether the given transform is a sub-tree of this transform.
This routine uses transform equality to identify sub-trees, therefore in many situations it is object id which will be used.
For the case where the given transform represents the whole of this transform, returns True.
Return whether the given branch is a sub-tree of this transform on each separate dimension.
A common use for this method is to identify if a transform is a blended transform containing an axes' data transform. e.g.:
Return the number of transforms which have been chained together to form this Transform instance.
Note
For the special case of a Composite transform, the maximum depth of the two is returned.
Get the affine part of this transform.
Get the matrix for the affine part of this transform.
True if this transform has a corresponding inverse transform.
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.
Return the corresponding inverse transformation.
It holds x == self.inverted().transform(self.transform(x)).
The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.
True if this transform is separable in the x- and y- dimensions.
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.
Apply this transformation on the given array of values.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Apply only the affine part of this transformation on the given array of values.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally a no-op. In affine transformations, this is equivalent to transform(values).
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Transform a set of angles anchored at specific locations.
The angles to transform.
The points where the angles are anchored.
Whether angles are radians or degrees.
For each point in pts and angle in angles, the transformed angle is computed by transforming a segment of length pushoff starting at that point and making that angle relative to the horizontal axis, and measuring the angle between the horizontal axis and the transformed segment.
Transform the given bounding box.
For smarter transforms including caching (a common requirement in Matplotlib), see TransformedBbox.
Apply only the non-affine part of this transformation.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.
Apply the transform to Path path, returning a new Path.
In some cases, this transform may insert curves into the path that began as line segments.
Apply the affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).
Apply the non-affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).
Return a transformed point.
This function is only kept for backcompatibility; the more general transform method is capable of transforming both a list of points and a single point.
The point is given as a sequence of length input_dims. The transformed point is returned as a sequence of length output_dims.


Compose two transforms together so that self is followed by other.
A + B returns a transform C so that C.transform(x) == B.transform(A.transform(x)).


Array interface to get at this Transform's affine matrix.


This method is called when a class is subclassed.
The default implementation does nothing. It may be overridden to extend subclasses.


Compose self with the inverse of other, cancelling identical terms if any:
Cancellation (rather than naively returning A + B.inverted()) is important for multiple reasons:


Return whether the given transform is a sub-tree of this transform.
This routine uses transform equality to identify sub-trees, therefore in many situations it is object id which will be used.
For the case where the given transform represents the whole of this transform, returns True.


Return whether the given branch is a sub-tree of this transform on each separate dimension.
A common use for this method is to identify if a transform is a blended transform containing an axes' data transform. e.g.:


Get the matrix for the affine part of this transform.


True if this transform has a corresponding inverse transform.


The number of input dimensions of this transform. Must be overridden (with integers) in the subclass.


Return the corresponding inverse transformation.
It holds x == self.inverted().transform(self.transform(x)).
The return value of this method should be treated as temporary. An update to self does not cause a corresponding update to its inverted copy.


True if this transform is separable in the x- and y- dimensions.


The number of output dimensions of this transform. Must be overridden (with integers) in the subclass.


Apply this transformation on the given array of values.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.


Apply only the affine part of this transformation on the given array of values.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally a no-op. In affine transformations, this is equivalent to transform(values).
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.


Transform a set of angles anchored at specific locations.
The angles to transform.
The points where the angles are anchored.
Whether angles are radians or degrees.
For each point in pts and angle in angles, the transformed angle is computed by transforming a segment of length pushoff starting at that point and making that angle relative to the horizontal axis, and measuring the angle between the horizontal axis and the transformed segment.


Transform the given bounding box.
For smarter transforms including caching (a common requirement in Matplotlib), see TransformedBbox.


Apply only the non-affine part of this transformation.
transform(values) is always equivalent to transform_affine(transform_non_affine(values)).
In non-affine transformations, this is generally equivalent to transform(values). In affine transformations, this is always a no-op.
The input values as NumPy array of length input_dims or shape (N x input_dims).
The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.


Apply the transform to Path path, returning a new Path.
In some cases, this transform may insert curves into the path that began as line segments.


Apply the affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).


Apply the non-affine part of this transform to Path path, returning a new Path.
transform_path(path) is equivalent to transform_path_affine(transform_path_non_affine(values)).


Return a transformed point.
This function is only kept for backcompatibility; the more general transform method is capable of transforming both a list of points and a single point.
The point is given as a sequence of length input_dims. The transformed point is returned as a sequence of length output_dims.


Bases: matplotlib.transforms.BboxBase
A Bbox that is automatically transformed by a given transform. When either the child bounding box or transform changes, the bounds of this bbox will update accordingly.
Return str(self).


Bases: matplotlib.transforms.TransformedPath
A TransformedPatchPath caches a non-affine transformed copy of the Patch. This cached copy is automatically updated when the non-affine part of the transform or the patch changes.


Bases: matplotlib.transforms.TransformNode
A TransformedPath caches a non-affine transformed copy of the Path. This cached copy is automatically updated when the non-affine part of the transform changes.
Note
Paths are considered immutable by this class. Any update to the path's vertices/codes will not trigger a transform recomputation.
Return a fully-transformed copy of the child path.
Return a copy of the child path, with the non-affine part of the transform already applied, along with the affine part of the path necessary to complete the transformation.
Return a copy of the child path, with the non-affine part of the transform already applied, along with the affine part of the path necessary to complete the transformation. Unlike get_transformed_path_and_affine(), no interpolation will be performed.


Return a fully-transformed copy of the child path.


Return a copy of the child path, with the non-affine part of the transform already applied, along with the affine part of the path necessary to complete the transformation.


Return a copy of the child path, with the non-affine part of the transform already applied, along with the affine part of the path necessary to complete the transformation. Unlike get_transformed_path_and_affine(), no interpolation will be performed.


Bases: object
The base class for anything that participates in the transform tree and needs to invalidate its parents or be invalidated. This includes classes that are not really transforms, such as bounding boxes, since some transforms depend on bounding boxes to compute their values.
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.
A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.
list of weak references to the object (if defined)
Return a frozen copy of this transform node. The frozen copy will not be updated when its children change. Useful for storing a previously known state of a transform where copy.deepcopy() might normally be used.
Invalidate this TransformNode and triggers an invalidation of its ancestors. Should be called any time the transform changes.
If pass_through is True, all ancestors will always be invalidated, even if 'self' is already invalid.
Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform. Should be called from the constructor of any transforms that depend on other transforms.


A string representing the "name" of the transform. The name carries no significance other than to improve the readability of str(transform) when DEBUG=True.


list of weak references to the object (if defined)


Return a frozen copy of this transform node. The frozen copy will not be updated when its children change. Useful for storing a previously known state of a transform where copy.deepcopy() might normally be used.


Invalidate this TransformNode and triggers an invalidation of its ancestors. Should be called any time the transform changes.


If pass_through is True, all ancestors will always be invalidated, even if 'self' is already invalid.


Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform. Should be called from the constructor of any transforms that depend on other transforms.


Bases: matplotlib.transforms.Transform
A helper class that holds a single child transform and acts equivalently to it.
This is useful if a node of the transform tree must be replaced at run time with a transform of a different type. This class allows that replacement to correctly trigger invalidation.
TransformWrapper instances must have the same input and output dimensions during their entire lifetime, so the child transform may only be replaced with another child transform of the same dimensions.
child: A Transform instance. This child may later be replaced with set().
Return self==value.
child: A Transform instance. This child may later be replaced with set().
Return str(self).
Return a frozen copy of this transform node. The frozen copy will not be updated when its children change. Useful for storing a previously known state of a transform where copy.deepcopy() might normally be used.
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
bool(x) -> bool
Returns True when the argument x is true, False otherwise. The builtins True and False are the only two instances of the class bool. The class bool is a subclass of the class int, and cannot be subclassed.
If pass_through is True, all ancestors will always be invalidated, even if 'self' is already invalid.
Replace the current child of this transform with another one.
The new child must have the same number of input and output dimensions as the current child.


child: A Transform instance. This child may later be replaced with set().


Replace the current child of this transform with another one.
The new child must have the same number of input and output dimensions as the current child.


Unstructured triangular grid functions.
An unstructured triangular grid consisting of npoints points and ntri triangles. The triangles can either be specified by the user or automatically generated using a Delaunay triangulation.
Coordinates of grid points.
For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. If not specified, the Delaunay triangulation is calculated.
Which triangles are masked out.
For a Triangulation to be valid it must not have duplicate points, triangles formed from colinear points, or overlapping triangles.
For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. If you want to take the mask into account, use get_masked_triangles instead.
Masked out triangles.
Whether the Triangulation is a calculated Delaunay triangulation (where triangles was not specified) or not.
Calculate plane equation coefficients for all unmasked triangles from the point (x, y) coordinates and specified z-array of shape (npoints). The returned array has shape (npoints, 3) and allows z-value at (x, y) position in triangle tri to be calculated using z = array[tri, 0] * x  + array[tri, 1] * y + array[tri, 2].
Return integer array of shape (nedges, 2) containing all edges of non-masked triangles.
Each row defines an edge by it's start point index and end point index. Each edge appears only once, i.e. for an edge between points i and j, there will only be either (i, j) or (j, i).
Return the underlying C++ Triangulation object, creating it if necessary.
Return a Triangulation object from the args and kwargs, and the remaining args and kwargs with the consumed values removed.
There are two alternatives: either the first argument is a Triangulation object, in which case it is returned, or the args and kwargs are sufficient to create a new Triangulation to return. In the latter case, see Triangulation.__init__ for the possible args and kwargs.
Return an array of triangles that are not masked.
Return the default matplotlib.tri.TriFinder of this triangulation, creating it if necessary. This allows the same TriFinder object to be easily shared.
Return integer array of shape (ntri, 3) containing neighbor triangles.
For each triangle, the indices of the three triangles that share the same edges, or -1 if there is no such neighboring triangle. neighbors[i, j] is the triangle that is the neighbor to the edge from point index triangles[i, j] to point index triangles[i, (j+1)%3].
Set or clear the mask array.
Bases: matplotlib.contour.ContourSet
Create and store a set of contour lines or filled regions for a triangular grid.
This class is typically not instantiated directly by the user but by tricontour and tricontourf.
The Axes object in which the contours are drawn.
The Artists representing the contour. This is a list of PathCollections for both line and filled contours.
The values of the contour levels.
Same as levels for line contours; half-way between levels for filled contours. See ContourSet._process_colors.
Draw triangular grid contour lines or filled regions, depending on whether keyword arg 'filled' is False (default) or True.
The first argument of the initializer must be an axes object. The remaining arguments and keyword arguments are described in the docstring of tricontour.
Abstract base class for classes used to find the triangles of a Triangulation in which (x, y) points lie.
Rather than instantiate an object of a class derived from TriFinder, it is usually better to use the function Triangulation.get_trifinder.
Derived classes implement __call__(x, y) where x and y are array-like point coordinates of the same shape.
Bases: matplotlib.tri.trifinder.TriFinder
TriFinder class implemented using the trapezoid map algorithm from the book "Computational Geometry, Algorithms and Applications", second edition, by M. de Berg, M. van Kreveld, M. Overmars and O. Schwarzkopf.
The triangulation must be valid, i.e. it must not have duplicate points, triangles formed from colinear points, or overlapping triangles. The algorithm has some tolerance to triangles formed from colinear points, but this should not be relied upon.
Abstract base class for classes used to interpolate on a triangular grid.
Derived classes implement the following methods:
Bases: matplotlib.tri.triinterpolate.TriInterpolator
Linear interpolator on a triangular grid.
Each triangle is represented by a plane so that an interpolated value at point (x, y) lies on the plane of the triangle containing (x, y). Interpolated values are therefore continuous across the triangulation, but their first derivatives are discontinuous at edges between triangles.
The triangulation to interpolate over.
Array of values, defined at grid points, to interpolate between.
If this is not specified, the Triangulation's default TriFinder will be used by calling Triangulation.get_trifinder.
`__call__` (x, y)
(Returns interpolated values at (x, y) points.)
`gradient` (x, y)
(Returns interpolated derivatives at (x, y) points.)
Returns a list of 2 masked arrays containing interpolated derivatives at the specified (x, y) points.
x and y coordinates of the same shape and any number of dimensions.
2 masked arrays of the same shape as x and y; values corresponding to (x, y) points outside of the triangulation are masked out. The first returned array contains the values of \(\frac{\partial z}{\partial x}\) and the second those of \(\frac{\partial z}{\partial y}\).
Bases: matplotlib.tri.triinterpolate.TriInterpolator
Cubic interpolator on a triangular grid.
In one-dimension - on a segment - a cubic interpolating function is defined by the values of the function and its derivative at both ends. This is almost the same in 2D inside a triangle, except that the values of the function and its 2 derivatives have to be defined at each triangle node.
The CubicTriInterpolator takes the value of the function at each node - provided by the user - and internally computes the value of the derivatives, resulting in a smooth interpolation. (As a special feature, the user can also impose the value of the derivatives at each node, but this is not supposed to be the common usage.)
The triangulation to interpolate over.
Array of values, defined at grid points, to interpolate between.
Choice of the smoothing algorithm, in order to compute the interpolant derivatives (defaults to 'min_E'):
If not specified, the Triangulation's default TriFinder will be used by calling Triangulation.get_trifinder.
Used only if kind ='user'. In this case dz must be provided as (dzdx, dzdy) where dzdx, dzdy are arrays of the same shape as z and are the interpolant first derivatives at the triangulation points.
This note is a bit technical and details how the cubic interpolation is computed.
The interpolation is based on a Clough-Tocher subdivision scheme of the triangulation mesh (to make it clearer, each triangle of the grid will be divided in 3 child-triangles, and on each child triangle the interpolated function is a cubic polynomial of the 2 coordinates). This technique originates from FEM (Finite Element Method) analysis; the element used is a reduced Hsieh-Clough-Tocher (HCT) element. Its shape functions are described in [1]. The assembled function is guaranteed to be C1-smooth, i.e. it is continuous and its first derivatives are also continuous (this is easy to show inside the triangles but is also true when crossing the edges).
In the default case (kind ='min_E'), the interpolant minimizes a curvature energy on the functional space generated by the HCT element shape functions - with imposed values but arbitrary derivatives at each node. The minimized functional is the integral of the so-called total curvature (implementation based on an algorithm from [2] - PCG sparse solver):
If the case kind ='geom' is chosen by the user, a simple geometric approximation is used (weighted average of the triangle normal vectors), which could improve speed on very large grids.
Michel Bernadou, Kamal Hassan, "Basis functions for general Hsieh-Clough-Tocher triangles, complete or reduced.", International Journal for Numerical Methods in Engineering, 17(5):784 - 789. 2.01.
C.T. Kelley, "Iterative Methods for Optimization".
`__call__` (x, y)
(Returns interpolated values at (x, y) points.)
`gradient` (x, y)
(Returns interpolated derivatives at (x, y) points.)
Returns a list of 2 masked arrays containing interpolated derivatives at the specified (x, y) points.
x and y coordinates of the same shape and any number of dimensions.
2 masked arrays of the same shape as x and y; values corresponding to (x, y) points outside of the triangulation are masked out. The first returned array contains the values of \(\frac{\partial z}{\partial x}\) and the second those of \(\frac{\partial z}{\partial y}\).
Abstract base class for classes implementing mesh refinement.
A TriRefiner encapsulates a Triangulation object and provides tools for mesh refinement and interpolation.
Derived classes must implement:
refine_triangulation(return_tri_index=False, **kwargs) , where the optional keyword arguments kwargs are defined in each TriRefiner concrete implementation, and which returns:
refine_field(z, triinterpolator=None, **kwargs), where:
and which returns (as a tuple) a refined triangular mesh and the interpolated values of the field at the refined triangulation nodes.
Bases: matplotlib.tri.trirefine.TriRefiner
Uniform mesh refinement by recursive subdivisions.
The encapsulated triangulation (to be refined)
Refine a field defined on the encapsulated triangulation.
Values of the field to refine, defined at the nodes of the encapsulated triangulation. (n_points is the number of points in the initial triangulation)
Interpolator used for field interpolation. If not specified, a CubicTriInterpolator will be used.
Recursion level for the subdivision. Each triangle is divided into 4**subdiv child triangles.
The returned refined triangulation.
The returned interpolated field (at refi_tri nodes).
Compute an uniformly refined triangulation refi_triangulation of the encapsulated triangulation.
This function refines the encapsulated triangulation by splitting each father triangle into 4 child sub-triangles built on the edges midside nodes, recursing subdiv times. In the end, each triangle is hence divided into 4**subdiv child triangles.
Whether an index table indicating the father triangle index of each point is returned.
Recursion level for the subdivision. Each triangle is divided into 4**subdiv child triangles; hence, the default results in 64 refined subtriangles for each triangle of the initial triangulation.
The refined triangulation.
Index of the initial triangulation containing triangle, for each point of refi_triangulation. Returned only if return_tri_index is set to True.
Define basic tools for triangular mesh analysis and improvement.
A TriAnalyzer encapsulates a Triangulation object and provides basic tools for mesh analysis and mesh improvement.
The encapsulated triangulation to analyze.
Factors to rescale the triangulation into a unit square.
Return a measure of the triangulation triangles flatness.
The ratio of the incircle radius over the circumcircle radius is a widely used indicator of a triangle flatness. It is always <= 0.5 and == 0.5 only for equilateral triangles. Circle ratios below 0.01 denote very flat triangles.
To avoid unduly low values due to a difference of scale between the 2 axis, the triangular mesh can first be rescaled to fit inside a unit square with scale_factors (Only if rescale is True, which is its default value).
If True, internally rescale (based on scale_factors), so that the (unmasked) triangles fit exactly inside a unit square mesh.
Ratio of the incircle radius over the circumcircle radius, for each 'rescaled' triangle of the encapsulated triangulation. Values corresponding to masked triangles are masked out.
Eliminate excessively flat border triangles from the triangulation.
Returns a mask new_mask which allows to clean the encapsulated triangulation from its border-located flat triangles (according to their circle_ratios()). This mask is meant to be subsequently applied to the triangulation using Triangulation.set_mask. new_mask is an extension of the initial triangulation mask in the sense that an initially masked triangle will remain masked.
The new_mask array is computed recursively; at each step flat triangles are removed only if they share a side with the current mesh border. Thus no new holes in the triangulated domain will be created.
Border triangles with incircle/circumcircle radii ratio r/R will be removed if r/R < min_circle_ratio.
If True, first, internally rescale (based on scale_factors) so that the (unmasked) triangles fit exactly inside a unit square mesh. This rescaling accounts for the difference of scale which might exist between the 2 axis.
Mask to apply to encapsulated triangulation. All the initially masked triangles remain masked in the new_mask.
The rationale behind this function is that a Delaunay triangulation - of an unstructured set of points - sometimes contains almost flat triangles at its border, leading to artifacts in plots (especially for high-resolution contouring). Masked with computed new_mask, the encapsulated triangulation would contain no more unmasked border triangles with a circle ratio below min_circle_ratio, thus improving the mesh quality for subsequent plots or interpolation.
Factors to rescale the triangulation into a unit square.
Scaling factors (kx, ky) so that the triangulation [triangulation.x * kx, triangulation.y * ky] fits exactly inside a unit square.


Bases: matplotlib.tri.triinterpolate.TriInterpolator
Cubic interpolator on a triangular grid.
In one-dimension - on a segment - a cubic interpolating function is defined by the values of the function and its derivative at both ends. This is almost the same in 2D inside a triangle, except that the values of the function and its 2 derivatives have to be defined at each triangle node.
The CubicTriInterpolator takes the value of the function at each node - provided by the user - and internally computes the value of the derivatives, resulting in a smooth interpolation. (As a special feature, the user can also impose the value of the derivatives at each node, but this is not supposed to be the common usage.)
The triangulation to interpolate over.
Array of values, defined at grid points, to interpolate between.
Choice of the smoothing algorithm, in order to compute the interpolant derivatives (defaults to 'min_E'):
If not specified, the Triangulation's default TriFinder will be used by calling Triangulation.get_trifinder.
Used only if kind ='user'. In this case dz must be provided as (dzdx, dzdy) where dzdx, dzdy are arrays of the same shape as z and are the interpolant first derivatives at the triangulation points.
This note is a bit technical and details how the cubic interpolation is computed.
The interpolation is based on a Clough-Tocher subdivision scheme of the triangulation mesh (to make it clearer, each triangle of the grid will be divided in 3 child-triangles, and on each child triangle the interpolated function is a cubic polynomial of the 2 coordinates). This technique originates from FEM (Finite Element Method) analysis; the element used is a reduced Hsieh-Clough-Tocher (HCT) element. Its shape functions are described in [1]. The assembled function is guaranteed to be C1-smooth, i.e. it is continuous and its first derivatives are also continuous (this is easy to show inside the triangles but is also true when crossing the edges).
In the default case (kind ='min_E'), the interpolant minimizes a curvature energy on the functional space generated by the HCT element shape functions - with imposed values but arbitrary derivatives at each node. The minimized functional is the integral of the so-called total curvature (implementation based on an algorithm from [2] - PCG sparse solver):
If the case kind ='geom' is chosen by the user, a simple geometric approximation is used (weighted average of the triangle normal vectors), which could improve speed on very large grids.
Michel Bernadou, Kamal Hassan, "Basis functions for general Hsieh-Clough-Tocher triangles, complete or reduced.", International Journal for Numerical Methods in Engineering, 17(5):784 - 789. 2.01.
C.T. Kelley, "Iterative Methods for Optimization".
`__call__` (x, y)
(Returns interpolated values at (x, y) points.)
`gradient` (x, y)
(Returns interpolated derivatives at (x, y) points.)
Returns a list of 2 masked arrays containing interpolated derivatives at the specified (x, y) points.
x and y coordinates of the same shape and any number of dimensions.
2 masked arrays of the same shape as x and y; values corresponding to (x, y) points outside of the triangulation are masked out. The first returned array contains the values of \(\frac{\partial z}{\partial x}\) and the second those of \(\frac{\partial z}{\partial y}\).


Returns a list of 2 masked arrays containing interpolated derivatives at the specified (x, y) points.
x and y coordinates of the same shape and any number of dimensions.
2 masked arrays of the same shape as x and y; values corresponding to (x, y) points outside of the triangulation are masked out. The first returned array contains the values of \(\frac{\partial z}{\partial x}\) and the second those of \(\frac{\partial z}{\partial y}\).


Bases: matplotlib.tri.triinterpolate.TriInterpolator
Linear interpolator on a triangular grid.
Each triangle is represented by a plane so that an interpolated value at point (x, y) lies on the plane of the triangle containing (x, y). Interpolated values are therefore continuous across the triangulation, but their first derivatives are discontinuous at edges between triangles.
The triangulation to interpolate over.
Array of values, defined at grid points, to interpolate between.
If this is not specified, the Triangulation's default TriFinder will be used by calling Triangulation.get_trifinder.
`__call__` (x, y)
(Returns interpolated values at (x, y) points.)
`gradient` (x, y)
(Returns interpolated derivatives at (x, y) points.)
Returns a list of 2 masked arrays containing interpolated derivatives at the specified (x, y) points.
x and y coordinates of the same shape and any number of dimensions.
2 masked arrays of the same shape as x and y; values corresponding to (x, y) points outside of the triangulation are masked out. The first returned array contains the values of \(\frac{\partial z}{\partial x}\) and the second those of \(\frac{\partial z}{\partial y}\).


Bases: matplotlib.tri.trifinder.TriFinder
TriFinder class implemented using the trapezoid map algorithm from the book "Computational Geometry, Algorithms and Applications", second edition, by M. de Berg, M. van Kreveld, M. Overmars and O. Schwarzkopf.
The triangulation must be valid, i.e. it must not have duplicate points, triangles formed from colinear points, or overlapping triangles. The algorithm has some tolerance to triangles formed from colinear points, but this should not be relied upon.


Define basic tools for triangular mesh analysis and improvement.
A TriAnalyzer encapsulates a Triangulation object and provides basic tools for mesh analysis and mesh improvement.
The encapsulated triangulation to analyze.
Factors to rescale the triangulation into a unit square.
Return a measure of the triangulation triangles flatness.
The ratio of the incircle radius over the circumcircle radius is a widely used indicator of a triangle flatness. It is always <= 0.5 and == 0.5 only for equilateral triangles. Circle ratios below 0.01 denote very flat triangles.
To avoid unduly low values due to a difference of scale between the 2 axis, the triangular mesh can first be rescaled to fit inside a unit square with scale_factors (Only if rescale is True, which is its default value).
If True, internally rescale (based on scale_factors), so that the (unmasked) triangles fit exactly inside a unit square mesh.
Ratio of the incircle radius over the circumcircle radius, for each 'rescaled' triangle of the encapsulated triangulation. Values corresponding to masked triangles are masked out.
Eliminate excessively flat border triangles from the triangulation.
Returns a mask new_mask which allows to clean the encapsulated triangulation from its border-located flat triangles (according to their circle_ratios()). This mask is meant to be subsequently applied to the triangulation using Triangulation.set_mask. new_mask is an extension of the initial triangulation mask in the sense that an initially masked triangle will remain masked.
The new_mask array is computed recursively; at each step flat triangles are removed only if they share a side with the current mesh border. Thus no new holes in the triangulated domain will be created.
Border triangles with incircle/circumcircle radii ratio r/R will be removed if r/R < min_circle_ratio.
If True, first, internally rescale (based on scale_factors) so that the (unmasked) triangles fit exactly inside a unit square mesh. This rescaling accounts for the difference of scale which might exist between the 2 axis.
Mask to apply to encapsulated triangulation. All the initially masked triangles remain masked in the new_mask.
The rationale behind this function is that a Delaunay triangulation - of an unstructured set of points - sometimes contains almost flat triangles at its border, leading to artifacts in plots (especially for high-resolution contouring). Masked with computed new_mask, the encapsulated triangulation would contain no more unmasked border triangles with a circle ratio below min_circle_ratio, thus improving the mesh quality for subsequent plots or interpolation.
Factors to rescale the triangulation into a unit square.
Scaling factors (kx, ky) so that the triangulation [triangulation.x * kx, triangulation.y * ky] fits exactly inside a unit square.


Return a measure of the triangulation triangles flatness.
The ratio of the incircle radius over the circumcircle radius is a widely used indicator of a triangle flatness. It is always <= 0.5 and == 0.5 only for equilateral triangles. Circle ratios below 0.01 denote very flat triangles.
To avoid unduly low values due to a difference of scale between the 2 axis, the triangular mesh can first be rescaled to fit inside a unit square with scale_factors (Only if rescale is True, which is its default value).
If True, internally rescale (based on scale_factors), so that the (unmasked) triangles fit exactly inside a unit square mesh.
Ratio of the incircle radius over the circumcircle radius, for each 'rescaled' triangle of the encapsulated triangulation. Values corresponding to masked triangles are masked out.


Eliminate excessively flat border triangles from the triangulation.
Returns a mask new_mask which allows to clean the encapsulated triangulation from its border-located flat triangles (according to their circle_ratios()). This mask is meant to be subsequently applied to the triangulation using Triangulation.set_mask. new_mask is an extension of the initial triangulation mask in the sense that an initially masked triangle will remain masked.
The new_mask array is computed recursively; at each step flat triangles are removed only if they share a side with the current mesh border. Thus no new holes in the triangulated domain will be created.
Border triangles with incircle/circumcircle radii ratio r/R will be removed if r/R < min_circle_ratio.
If True, first, internally rescale (based on scale_factors) so that the (unmasked) triangles fit exactly inside a unit square mesh. This rescaling accounts for the difference of scale which might exist between the 2 axis.
Mask to apply to encapsulated triangulation. All the initially masked triangles remain masked in the new_mask.
The rationale behind this function is that a Delaunay triangulation - of an unstructured set of points - sometimes contains almost flat triangles at its border, leading to artifacts in plots (especially for high-resolution contouring). Masked with computed new_mask, the encapsulated triangulation would contain no more unmasked border triangles with a circle ratio below min_circle_ratio, thus improving the mesh quality for subsequent plots or interpolation.


An unstructured triangular grid consisting of npoints points and ntri triangles. The triangles can either be specified by the user or automatically generated using a Delaunay triangulation.
Coordinates of grid points.
For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. If not specified, the Delaunay triangulation is calculated.
Which triangles are masked out.
For a Triangulation to be valid it must not have duplicate points, triangles formed from colinear points, or overlapping triangles.
For each triangle, the indices of the three points that make up the triangle, ordered in an anticlockwise manner. If you want to take the mask into account, use get_masked_triangles instead.
Masked out triangles.
Whether the Triangulation is a calculated Delaunay triangulation (where triangles was not specified) or not.
Calculate plane equation coefficients for all unmasked triangles from the point (x, y) coordinates and specified z-array of shape (npoints). The returned array has shape (npoints, 3) and allows z-value at (x, y) position in triangle tri to be calculated using z = array[tri, 0] * x  + array[tri, 1] * y + array[tri, 2].
Return integer array of shape (nedges, 2) containing all edges of non-masked triangles.
Each row defines an edge by it's start point index and end point index. Each edge appears only once, i.e. for an edge between points i and j, there will only be either (i, j) or (j, i).
Return the underlying C++ Triangulation object, creating it if necessary.
Return a Triangulation object from the args and kwargs, and the remaining args and kwargs with the consumed values removed.
There are two alternatives: either the first argument is a Triangulation object, in which case it is returned, or the args and kwargs are sufficient to create a new Triangulation to return. In the latter case, see Triangulation.__init__ for the possible args and kwargs.
Return an array of triangles that are not masked.
Return the default matplotlib.tri.TriFinder of this triangulation, creating it if necessary. This allows the same TriFinder object to be easily shared.
Return integer array of shape (ntri, 3) containing neighbor triangles.
For each triangle, the indices of the three triangles that share the same edges, or -1 if there is no such neighboring triangle. neighbors[i, j] is the triangle that is the neighbor to the edge from point index triangles[i, j] to point index triangles[i, (j+1)%3].
Set or clear the mask array.


Calculate plane equation coefficients for all unmasked triangles from the point (x, y) coordinates and specified z-array of shape (npoints). The returned array has shape (npoints, 3) and allows z-value at (x, y) position in triangle tri to be calculated using z = array[tri, 0] * x  + array[tri, 1] * y + array[tri, 2].


Return the underlying C++ Triangulation object, creating it if necessary.


Return a Triangulation object from the args and kwargs, and the remaining args and kwargs with the consumed values removed.
There are two alternatives: either the first argument is a Triangulation object, in which case it is returned, or the args and kwargs are sufficient to create a new Triangulation to return. In the latter case, see Triangulation.__init__ for the possible args and kwargs.


Return an array of triangles that are not masked.


Return the default matplotlib.tri.TriFinder of this triangulation, creating it if necessary. This allows the same TriFinder object to be easily shared.


Bases: matplotlib.contour.ContourSet
Create and store a set of contour lines or filled regions for a triangular grid.
This class is typically not instantiated directly by the user but by tricontour and tricontourf.
The Axes object in which the contours are drawn.
The Artists representing the contour. This is a list of PathCollections for both line and filled contours.
The values of the contour levels.
Same as levels for line contours; half-way between levels for filled contours. See ContourSet._process_colors.
Draw triangular grid contour lines or filled regions, depending on whether keyword arg 'filled' is False (default) or True.
The first argument of the initializer must be an axes object. The remaining arguments and keyword arguments are described in the docstring of tricontour.


Abstract base class for classes used to find the triangles of a Triangulation in which (x, y) points lie.
Rather than instantiate an object of a class derived from TriFinder, it is usually better to use the function Triangulation.get_trifinder.
Derived classes implement __call__(x, y) where x and y are array-like point coordinates of the same shape.


Abstract base class for classes used to interpolate on a triangular grid.
Derived classes implement the following methods:


Abstract base class for classes implementing mesh refinement.
A TriRefiner encapsulates a Triangulation object and provides tools for mesh refinement and interpolation.
Derived classes must implement:
refine_triangulation(return_tri_index=False, **kwargs) , where the optional keyword arguments kwargs are defined in each TriRefiner concrete implementation, and which returns:
refine_field(z, triinterpolator=None, **kwargs), where:
and which returns (as a tuple) a refined triangular mesh and the interpolated values of the field at the refined triangulation nodes.


Bases: matplotlib.tri.trirefine.TriRefiner
Uniform mesh refinement by recursive subdivisions.
The encapsulated triangulation (to be refined)
Refine a field defined on the encapsulated triangulation.
Values of the field to refine, defined at the nodes of the encapsulated triangulation. (n_points is the number of points in the initial triangulation)
Interpolator used for field interpolation. If not specified, a CubicTriInterpolator will be used.
Recursion level for the subdivision. Each triangle is divided into 4**subdiv child triangles.
The returned refined triangulation.
The returned interpolated field (at refi_tri nodes).
Compute an uniformly refined triangulation refi_triangulation of the encapsulated triangulation.
This function refines the encapsulated triangulation by splitting each father triangle into 4 child sub-triangles built on the edges midside nodes, recursing subdiv times. In the end, each triangle is hence divided into 4**subdiv child triangles.
Whether an index table indicating the father triangle index of each point is returned.
Recursion level for the subdivision. Each triangle is divided into 4**subdiv child triangles; hence, the default results in 64 refined subtriangles for each triangle of the initial triangulation.
The refined triangulation.
Index of the initial triangulation containing triangle, for each point of refi_triangulation. Returned only if return_tri_index is set to True.


Refine a field defined on the encapsulated triangulation.
Values of the field to refine, defined at the nodes of the encapsulated triangulation. (n_points is the number of points in the initial triangulation)
Interpolator used for field interpolation. If not specified, a CubicTriInterpolator will be used.
Recursion level for the subdivision. Each triangle is divided into 4**subdiv child triangles.
The returned refined triangulation.
The returned interpolated field (at refi_tri nodes).


Compute an uniformly refined triangulation refi_triangulation of the encapsulated triangulation.
This function refines the encapsulated triangulation by splitting each father triangle into 4 child sub-triangles built on the edges midside nodes, recursing subdiv times. In the end, each triangle is hence divided into 4**subdiv child triangles.
Whether an index table indicating the father triangle index of each point is returned.
Recursion level for the subdivision. Each triangle is divided into 4**subdiv child triangles; hence, the default results in 64 refined subtriangles for each triangle of the initial triangulation.
The refined triangulation.
Index of the initial triangulation containing triangle, for each point of refi_triangulation. Returned only if return_tri_index is set to True.


A class representing a Type 1 font.
This version reads pfa and pfb files and splits them for embedding in pdf files. It also supports SlantFont and ExtendFont transformations, similarly to pdfTeX and friends. There is no support yet for subsetting.
Usage:
Sources:
Bases: object
A class representing a Type-1 font, for use by backends.
A 3-tuple of the cleartext part, the encrypted part, and the finale of zeros.
The decrypted form of parts[1].
A dictionary of font properties.
Initialize a Type-1 font.
Either a pfb file name, or a 3-tuple of already-decoded Type-1 font parts.
Return a new font that is slanted and/or extended.
A dict with optional entries:
Tangent of the angle that the font is to be slanted to the right. Negative values slant to the left.
Scaling factor for the font width. Values less than 1 condense the glyphs.


Bases: object
A class representing a Type-1 font, for use by backends.
A 3-tuple of the cleartext part, the encrypted part, and the finale of zeros.
The decrypted form of parts[1].
A dictionary of font properties.
Initialize a Type-1 font.
Either a pfb file name, or a 3-tuple of already-decoded Type-1 font parts.
Return a new font that is slanted and/or extended.
A dict with optional entries:
Tangent of the angle that the font is to be slanted to the right. Negative values slant to the left.
Scaling factor for the font width. Values less than 1 condense the glyphs.


Return a new font that is slanted and/or extended.
A dict with optional entries:
Tangent of the angle that the font is to be slanted to the right. Negative values slant to the left.
Scaling factor for the font width. Values less than 1 condense the glyphs.


The classes here provide support for using custom classes with Matplotlib, e.g., those that do not expose the array interface but know how to convert themselves to arrays. It also supports classes with units and units conversion. Use cases include converters for custom objects, e.g., a list of datetime objects, as well as for objects that are unit aware. We don't assume any particular units implementation; rather a units implementation must register with the Registry converter dictionary and provide a ConversionInterface. For example, here is a complete implementation which supports plotting with native datetime objects:
Bases: object
Information to support default axis labeling, tick labeling, and limits.
An instance of this class must be returned by ConversionInterface.axisinfo.
Tick locators for the major and minor ticks.
Tick formatters for the major and minor ticks.
The default axis label.
The default min and max limits of the axis if no data has been plotted.
If any of the above are None, the axis will simply use the default value.
Bases: TypeError
Bases: object
The minimal interface for a converter to take custom data types (or sequences) and convert them to values Matplotlib can use.
Return an AxisInfo for the axis with the specified units.
Convert obj using unit for the specified axis.
If obj is a sequence, return the converted sequence. The output must be a sequence of scalars that can be used by the numpy array layer.
Return the default unit for x or None for the given axis.
[Deprecated] The Matplotlib datalim, autoscaling, locators etc work with scalars which are the units converted to floats given the current unit. The converter may be passed these floats, or arrays of them, even when units are set.
Deprecated since version 3.5.
Bases: matplotlib.units.ConversionInterface
Converter for decimal.Decimal data to float.
Convert Decimals to floats.
The unit and axis arguments are not used.
Decimal or list of Decimal need to be converted
Bases: dict
Register types with conversion interface.
Get the converter interface instance for x, or None.


Bases: object
Information to support default axis labeling, tick labeling, and limits.
An instance of this class must be returned by ConversionInterface.axisinfo.
Tick locators for the major and minor ticks.
Tick formatters for the major and minor ticks.
The default axis label.
The default min and max limits of the axis if no data has been plotted.
If any of the above are None, the axis will simply use the default value.


Bases: object
The minimal interface for a converter to take custom data types (or sequences) and convert them to values Matplotlib can use.
Return an AxisInfo for the axis with the specified units.
Convert obj using unit for the specified axis.
If obj is a sequence, return the converted sequence. The output must be a sequence of scalars that can be used by the numpy array layer.
Return the default unit for x or None for the given axis.
[Deprecated] The Matplotlib datalim, autoscaling, locators etc work with scalars which are the units converted to floats given the current unit. The converter may be passed these floats, or arrays of them, even when units are set.
Deprecated since version 3.5.


Return an AxisInfo for the axis with the specified units.


Convert obj using unit for the specified axis.
If obj is a sequence, return the converted sequence. The output must be a sequence of scalars that can be used by the numpy array layer.


Return the default unit for x or None for the given axis.


[Deprecated] The Matplotlib datalim, autoscaling, locators etc work with scalars which are the units converted to floats given the current unit. The converter may be passed these floats, or arrays of them, even when units are set.
Deprecated since version 3.5.


Bases: matplotlib.units.ConversionInterface
Converter for decimal.Decimal data to float.
Convert Decimals to floats.
The unit and axis arguments are not used.
Decimal or list of Decimal need to be converted


Convert Decimals to floats.
The unit and axis arguments are not used.
Decimal or list of Decimal need to be converted


Bases: dict
Register types with conversion interface.
Get the converter interface instance for x, or None.


Get the converter interface instance for x, or None.


Select the backend used for rendering and GUI integration.
The backend to switch to. This can either be one of the standard backend names, which are case-insensitive:
or a string of the form: module://my.module.name.
Switching to an interactive backend is not possible if an unrelated event loop has already been started (e.g., switching to GTK3Agg if a TkAgg window has already been opened). Switching to a non-interactive backend is always possible.
If True (the default), raise an ImportError if the backend cannot be set up (either because it fails to import, or because an incompatible GUI interactive framework is already running); if False, silently ignore the failure.
See also


Widgets that are designed to work for any of the GUI backends. All of these widgets require you to predefine a matplotlib.axes.Axes instance and pass that as the first parameter. Matplotlib doesn't try to be too smart with respect to layout -- you will have to figure out how wide and tall you want your Axes to be to accommodate your widget.
Bases: matplotlib.widgets.Widget
Widget connected to a single Axes.
To guarantee that the widget remains responsive and not garbage-collected, a reference to the object should be maintained by the user.
This is necessary because the callback registry maintains only weak-refs to the functions, which are member functions of the widget. If there are no references to the widget object it may be garbage collected which will disconnect the callbacks.
The parent axes for the widget.
The parent figure canvas for the widget.
Is the widget active?
Connect a callback function with an event.
This should be used in lieu of figure.canvas.mpl_connect since this function stores callback ids for later clean up.
Disconnect all events created by this widget.
Bases: matplotlib.widgets.AxesWidget
A GUI neutral button.
For the button to remain responsive you must keep a reference to it. Call on_clicked to connect to the button.
The matplotlib.axes.Axes the button renders into.
A matplotlib.text.Text instance.
The color of the button when not hovering.
The color of the button when hovering.
The Axes instance the button will be placed into.
The button text.
The image to place in the button, if not None. The parameter is directly forwarded to imshow.
The color of the button when not activated.
The color of the button when the mouse is over it.
Remove the callback function with connection id cid.
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.
Bases: matplotlib.widgets.AxesWidget
A GUI neutral set of check buttons.
For the check buttons to remain responsive you must keep a reference to this object.
Connect to the CheckButtons with the on_clicked method.
The parent axes for the widget.
List of lines for the x's in the check boxes. These lines exist for each box, but have set_visible(False) when its box is not checked.
Add check buttons to matplotlib.axes.Axes instance ax.
The parent axes for the widget.
The labels of the check buttons.
The initial check states of the buttons. The list must have the same length as labels. If not given, all buttons are unchecked.
Remove the observer with connection id cid.
Return a tuple of the status (True/False) of all of the check buttons.
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.
Toggle (activate or deactivate) a check button by index.
Callbacks will be triggered if eventson is True.
Index of the check button to toggle.
If index is invalid.
Bases: matplotlib.widgets.AxesWidget
A crosshair cursor that spans the axes and moves with mouse cursor.
For the cursor to remain responsive you must keep a reference to it.
The Axes to attach the cursor to.
Whether to draw the horizontal line.
Whether to draw the vertical line.
Use blitting for faster drawing if supported by the backend.
Line2D properties that control the appearance of the lines. See also axhline.
See Cursor.
Internal event handler to clear the cursor.
Internal event handler to draw the cursor when the mouse moves.
Bases: matplotlib.widgets.RectangleSelector
Select an elliptical region of an axes.
For the cursor to remain responsive you must keep a reference to it.
Press and release events triggered at the same coordinates outside the selection will clear the selector, except when ignore_event_outside=True.
The parent axes for the widget.
A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
Selections with an x-span less than or equal to minspanx are removed (when already existing) or cancelled.
Selections with an y-span less than or equal to minspanx are removed (when already existing) or cancelled.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the ellipse is drawn. See matplotlib.patches.Patch for valid properties. Default:
dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)
Whether to interpret minspanx and minspany in data or in pixel coordinates.
Button(s) that trigger rectangle selection.
Distance in pixels within which the interactive tool handles can be activated.
Properties with which the interactive handles (marker artists) are drawn. See the marker arguments in matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams except for the default value of markeredgecolor which will be the same as the edgecolor property in props.
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
Keyboard modifiers which affect the widget's behavior. Values amend the defaults.
"square" and "center" can be combined.
If True, the widget can be moved by clicking anywhere within its bounds.
If True, the event triggered outside the span selector will be ignored.
Rectangle and ellipse selectors
Bases: matplotlib.widgets.AxesWidget
Selection curve of an arbitrary shape.
The selected path can be used in conjunction with contains_point to select data points from an image.
Unlike LassoSelector, this must be initialized with a starting point xy, and the Lasso events are destroyed upon release.
The parent axes for the widget.
Coordinates of the start of the lasso.
Whether to use blitting for faster drawing (if supported by the backend).
Whenever the lasso is released, the callback function is called and passed the vertices of the selected path.
Bases: matplotlib.widgets._SelectorWidget
Selection curve of an arbitrary shape.
For the selector to remain responsive you must keep a reference to it.
The selected path can be used in conjunction with contains_point to select data points from an image.
In contrast to Lasso, LassoSelector is written with an interface similar to RectangleSelector and SpanSelector, and will continue to interact with the axes until disconnected.
Example usage:
The parent axes for the widget.
Whenever the lasso is released, the onselect function is called and passed the vertices of the selected path.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the line is drawn, see matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams.
The mouse buttons used for rectangle selection. Default is None, which corresponds to all buttons.
[Deprecated]
Deprecated since version 3.5:
[Deprecated]
Deprecated since version 3.5:
Bases: object
Some widgets, like the cursor, draw onto the canvas, and this is not desirable under all circumstances, like when the toolbar is in zoom-to-rect mode and drawing a rectangle. To avoid this, a widget can acquire a canvas' lock with canvas.widgetlock(widget) before drawing on the canvas; this will prevent other widgets from doing so at the same time (if they also try to acquire the lock first).
Return whether drawing is available to o.
Return whether o owns this lock.
Return whether the lock is currently held by an owner.
Release the lock from o.
Bases: matplotlib.widgets.Widget
Provide a vertical (default) and/or horizontal line cursor shared between multiple axes.
For the cursor to remain responsive you must keep a reference to it.
The FigureCanvas that contains all the axes.
The Axes to attach the cursor to.
Use blitting for faster drawing if supported by the backend.
Whether to draw the horizontal line.
Whether to draw the vertical line.
Line2D properties that control the appearance of the lines. See also axhline.
See Multicursor.
Clear the cursor.
Connect events.
Disconnect events.
Bases: matplotlib.widgets._SelectorWidget
Select a polygon region of an axes.
Place vertices with each mouse click, and make the selection by completing the polygon (clicking on the first vertex). Once drawn individual vertices can be moved by clicking and dragging with the left mouse button, or removed by clicking the right mouse button.
In addition, the following modifier keys can be used:
For the selector to remain responsive you must keep a reference to it.
The parent axes for the widget.
When a polygon is completed or modified after completion, the onselect function is called and passed a list of the vertices as (xdata, ydata) tuples.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the line is drawn, see matplotlib.lines.Line2D for valid properties. Default:
dict(color='k', linestyle='-', linewidth=2, alpha=0.5)
Artist properties for the markers drawn at the vertices of the polygon. See the marker arguments in matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams except for the default value of markeredgecolor which will be the same as the color property in props.
A vertex is selected (to complete the polygon or to move a vertex) if the mouse click is within grab_range pixels of the vertex.
If only one point remains after removing points, the selector reverts to an incomplete state and you can start drawing a new polygon from the existing point.
Polygon Selector
Cursor move event handler and validator.
The polygon vertices, as a list of (x, y) pairs.
Bases: matplotlib.widgets.AxesWidget
A GUI neutral radio button.
For the buttons to remain responsive you must keep a reference to this object.
Connect to the RadioButtons with the on_clicked method.
The parent axes for the widget.
The color of the selected button.
The button labels.
The buttons.
The label text of the currently selected button.
Add radio buttons to an Axes.
The axes to add the buttons to.
The button labels.
The index of the initially selected button.
The color of the selected button.
Remove the observer with connection id cid.
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.
Select button with number index.
Callbacks will be triggered if eventson is True.
Bases: matplotlib.widgets.SliderBase
A slider representing a range of floating point values. Defines the min and max of the range via the val attribute as a tuple of (min, max).
Create a slider that defines a range contained within [valmin, valmax] in axes ax. For the slider to remain responsive you must maintain a reference to it. Call on_changed() to connect to the slider event.
Slider value.
The Axes to put the slider in.
Slider label.
The minimum value of the slider.
The maximum value of the slider.
The initial positions of the slider. If None the initial positions will be at the 25th and 75th percentiles of the range.
%-format string used to format the slider values. If None, a ScalarFormatter is used instead.
Whether the slider interval is closed on the bottom.
Whether the slider interval is closed on the top.
If True the slider can be dragged by the mouse.
If given, the slider will snap to multiples of valstep.
The orientation of the slider.
The color of the background track. The track is accessible for further styling via the track attribute.
Properties of the slider handles. Default values are
Key
Value
Default
Description
facecolor
color
'white'
The facecolor of the slider handles.
edgecolor
color
'.75'
The edgecolor of the slider handles.
size
int
10
The size of the slider handles in points.
Other values will be transformed as marker{foo} and passed to the Line2D constructor. e.g. handle_style = {'style'='x'} will result in markerstyle = 'x'.
Additional kwargs are passed on to self.poly which is the Polygon that draws the slider knob. See the Polygon documentation for valid property names (facecolor, edgecolor, alpha, etc.).
Connect func as callback function to changes of the slider value.
Function to call when slider is changed. The function must accept a numpy array with shape (2,) as its argument.
Connection id (which can be used to disconnect func).
Set the lower value of the slider to max.
Set the lower value of the slider to min.
Set slider value to val.
Bases: matplotlib.widgets._SelectorWidget
Select a rectangular region of an axes.
For the cursor to remain responsive you must keep a reference to it.
Press and release events triggered at the same coordinates outside the selection will clear the selector, except when ignore_event_outside=True.
The parent axes for the widget.
A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
Selections with an x-span less than or equal to minspanx are removed (when already existing) or cancelled.
Selections with an y-span less than or equal to minspanx are removed (when already existing) or cancelled.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the rectangle is drawn. See matplotlib.patches.Patch for valid properties. Default:
dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)
Whether to interpret minspanx and minspany in data or in pixel coordinates.
Button(s) that trigger rectangle selection.
Distance in pixels within which the interactive tool handles can be activated.
Properties with which the interactive handles (marker artists) are drawn. See the marker arguments in matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams except for the default value of markeredgecolor which will be the same as the edgecolor property in props.
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
Keyboard modifiers which affect the widget's behavior. Values amend the defaults.
"square" and "center" can be combined.
If True, the widget can be moved by clicking anywhere within its bounds.
If True, the event triggered outside the span selector will be ignored.
See also: Rectangle and ellipse selectors
Center of rectangle.
Corners of rectangle from lower left, moving clockwise.
Midpoint of rectangle edges from left, moving anti-clockwise.
Return (xmin, xmax, ymin, ymax).
Return an array of shape (2, 5) containing the x (RectangleSelector.geometry[1, :]) and y (RectangleSelector.geometry[0, :]) coordinates of the four corners of the rectangle starting and ending in the top left corner.
Bases: matplotlib.widgets.SliderBase
A slider representing a floating point range.
Create a slider from valmin to valmax in axes ax. For the slider to remain responsive you must maintain a reference to it. Call on_changed() to connect to the slider event.
Slider value.
The Axes to put the slider in.
Slider label.
The minimum value of the slider.
The maximum value of the slider.
The slider initial position.
%-format string used to format the slider value. If None, a ScalarFormatter is used instead.
Whether the slider interval is closed on the bottom.
Whether the slider interval is closed on the top.
Do not allow the current slider to have a value less than the value of the Slider slidermin.
Do not allow the current slider to have a value greater than the value of the Slider slidermax.
If True the slider can be dragged by the mouse.
If a float, the slider will snap to multiples of valstep. If an array the slider will snap to the values in the array.
The orientation of the slider.
The color of the line at the valinit position. Set to 'none' for no line.
The color of the background track. The track is accessible for further styling via the track attribute.
Properties of the slider handle. Default values are
Key
Value
Default
Description
facecolor
color
'white'
The facecolor of the slider handle.
edgecolor
color
'.75'
The edgecolor of the slider handle.
size
int
10
The size of the slider handle in points.
Other values will be transformed as marker{foo} and passed to the Line2D constructor. e.g. handle_style = {'style'='x'} will result in markerstyle = 'x'.
Additional kwargs are passed on to self.poly which is the Polygon that draws the slider knob. See the Polygon documentation for valid property names (facecolor, edgecolor, alpha, etc.).
Connect func as callback function to changes of the slider value.
Function to call when slider is changed. The function must accept a single float as its arguments.
Connection id (which can be used to disconnect func).
Set slider value to val.
Bases: matplotlib.widgets.AxesWidget
The base class for constructing Slider widgets. Not intended for direct usage.
For the slider to remain responsive you must maintain a reference to it.
Remove the observer with connection id cid.
Connection id of the observer to be removed.
Reset the slider to the initial value.
Bases: matplotlib.widgets._SelectorWidget
Visually select a min/max range on a single axis and call a function with those values.
To guarantee that the selector remains responsive, keep a reference to it.
In order to turn off the SpanSelector, set span_selector.active to False. To turn it back on, set it to True.
Press and release events triggered at the same coordinates outside the selection will clear the selector, except when ignore_event_outside=True.
A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:
The direction along which to draw the span selector.
If selection is less than or equal to minspan, the selection is removed (when already existing) or cancelled.
If True, use the backend-dependent blitting features for faster canvas updates.
Dictionary of matplotlib.patches.Patch properties. Default:
dict(facecolor='red', alpha=0.5)
Called on mouse move while the span is being selected.
If True, the span stays visible after the mouse is released. Deprecated, use interactive instead.
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
The mouse buttons which activate the span selector.
Properties of the handle lines at the edges of the span. Only used when interactive is True. See matplotlib.lines.Line2D for valid properties.
Distance in pixels within which the interactive tool handles can be activated.
If True, the widget can be moved by clicking anywhere within its bounds.
If True, the event triggered outside the span selector will be ignored.
See also: Span Selector
Connect the major canvas events to methods.
Direction of the span selector: 'vertical' or 'horizontal'.
Return extents of the span selector.
Set SpanSelector to operate on a new Axes.
Bases: matplotlib.widgets.Widget
A tool to adjust the subplot params of a matplotlib.figure.Figure.
The figure instance to adjust.
The figure instance to embed the subplot tool into.
Bases: matplotlib.widgets.AxesWidget
A GUI neutral text input box.
For the text box to remain responsive you must keep a reference to it.
Call on_text_change to be updated whenever the text changes.
Call on_submit to be updated whenever the user hits enter or leaves the text entry field.
The parent axes for the widget.
The color of the text box when not hovering.
The color of the text box when hovering.
The Axes instance the button will be placed into.
Label for this text box.
Initial value in the text box.
The color of the box.
The color of the box when the mouse is over it.
The distance between the label and the right side of the textbox.
The horizontal location of the text.
Remove the observer with connection id cid.
When the user hits enter or leaves the submission box, call this func with event.
A connection id is returned which can be used to disconnect.
When the text changes, call this func with event.
A connection id is returned which can be used to disconnect.
Bases: object
Control handles for canvas tools.
Matplotlib axes where tool handles are displayed.
Coordinates of control handles.
Shape of marker used to display handle. See matplotlib.pyplot.plot.
Additional marker properties. See matplotlib.lines.Line2D.
Whether to use blitting for faster drawing (if supported by the backend).
Return index and pixel distance to closest index.
Set x and y positions of handles.
Bases: object
Control handles for canvas tools.
Matplotlib axes where tool handles are displayed.
Positions of handles in data coordinates.
Direction of handles, either 'vertical' or 'horizontal'
Additional line properties. See matplotlib.lines.Line2D.
Whether to use blitting for faster drawing (if supported by the backend).
Return index and pixel distance to closest handle.
x, y position from which the distance will be calculated to determinate the closest handle
position x, y
Direction of the handle: 'vertical' or 'horizontal'.
Positions of the handle in data coordinates.
Remove the handles artist from the figure.
Set the animated state of the handles artist.
Set x or y positions of handles, depending if the lines are vertical of horizontal.
Set the positions of the handle in data coordinates
Set the visibility state of the handles artist.
Bases: object
Abstract base class for GUI neutral widgets.
Is the widget active?
Get whether the widget is active.
Return whether event should be ignored.
This method should be called at the beginning of any event callback.
Set whether the widget is active.


Bases: matplotlib.widgets.Widget
Widget connected to a single Axes.
To guarantee that the widget remains responsive and not garbage-collected, a reference to the object should be maintained by the user.
This is necessary because the callback registry maintains only weak-refs to the functions, which are member functions of the widget. If there are no references to the widget object it may be garbage collected which will disconnect the callbacks.
The parent axes for the widget.
The parent figure canvas for the widget.
Is the widget active?
Connect a callback function with an event.
This should be used in lieu of figure.canvas.mpl_connect since this function stores callback ids for later clean up.
Disconnect all events created by this widget.


Connect a callback function with an event.
This should be used in lieu of figure.canvas.mpl_connect since this function stores callback ids for later clean up.


Disconnect all events created by this widget.


Bases: matplotlib.widgets.AxesWidget
A GUI neutral button.
For the button to remain responsive you must keep a reference to it. Call on_clicked to connect to the button.
The matplotlib.axes.Axes the button renders into.
A matplotlib.text.Text instance.
The color of the button when not hovering.
The color of the button when hovering.
The Axes instance the button will be placed into.
The button text.
The image to place in the button, if not None. The parameter is directly forwarded to imshow.
The color of the button when not activated.
The color of the button when the mouse is over it.
Remove the callback function with connection id cid.
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.


Remove the callback function with connection id cid.


Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.


Bases: matplotlib.widgets.AxesWidget
A GUI neutral set of check buttons.
For the check buttons to remain responsive you must keep a reference to this object.
Connect to the CheckButtons with the on_clicked method.
The parent axes for the widget.
List of lines for the x's in the check boxes. These lines exist for each box, but have set_visible(False) when its box is not checked.
Add check buttons to matplotlib.axes.Axes instance ax.
The parent axes for the widget.
The labels of the check buttons.
The initial check states of the buttons. The list must have the same length as labels. If not given, all buttons are unchecked.
Remove the observer with connection id cid.
Return a tuple of the status (True/False) of all of the check buttons.
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.
Toggle (activate or deactivate) a check button by index.
Callbacks will be triggered if eventson is True.
Index of the check button to toggle.
If index is invalid.


Remove the observer with connection id cid.


Return a tuple of the status (True/False) of all of the check buttons.


Toggle (activate or deactivate) a check button by index.
Callbacks will be triggered if eventson is True.
Index of the check button to toggle.
If index is invalid.


Bases: matplotlib.widgets.AxesWidget
A crosshair cursor that spans the axes and moves with mouse cursor.
For the cursor to remain responsive you must keep a reference to it.
The Axes to attach the cursor to.
Whether to draw the horizontal line.
Whether to draw the vertical line.
Use blitting for faster drawing if supported by the backend.
Line2D properties that control the appearance of the lines. See also axhline.
See Cursor.
Internal event handler to clear the cursor.
Internal event handler to draw the cursor when the mouse moves.


Internal event handler to clear the cursor.


Internal event handler to draw the cursor when the mouse moves.


Bases: matplotlib.widgets.RectangleSelector
Select an elliptical region of an axes.
For the cursor to remain responsive you must keep a reference to it.
Press and release events triggered at the same coordinates outside the selection will clear the selector, except when ignore_event_outside=True.
The parent axes for the widget.
A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
Selections with an x-span less than or equal to minspanx are removed (when already existing) or cancelled.
Selections with an y-span less than or equal to minspanx are removed (when already existing) or cancelled.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the ellipse is drawn. See matplotlib.patches.Patch for valid properties. Default:
dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)
Whether to interpret minspanx and minspany in data or in pixel coordinates.
Button(s) that trigger rectangle selection.
Distance in pixels within which the interactive tool handles can be activated.
Properties with which the interactive handles (marker artists) are drawn. See the marker arguments in matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams except for the default value of markeredgecolor which will be the same as the edgecolor property in props.
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
Keyboard modifiers which affect the widget's behavior. Values amend the defaults.
"square" and "center" can be combined.
If True, the widget can be moved by clicking anywhere within its bounds.
If True, the event triggered outside the span selector will be ignored.
Rectangle and ellipse selectors


Bases: matplotlib.widgets.AxesWidget
Selection curve of an arbitrary shape.
The selected path can be used in conjunction with contains_point to select data points from an image.
Unlike LassoSelector, this must be initialized with a starting point xy, and the Lasso events are destroyed upon release.
The parent axes for the widget.
Coordinates of the start of the lasso.
Whether to use blitting for faster drawing (if supported by the backend).
Whenever the lasso is released, the callback function is called and passed the vertices of the selected path.


Bases: matplotlib.widgets._SelectorWidget
Selection curve of an arbitrary shape.
For the selector to remain responsive you must keep a reference to it.
The selected path can be used in conjunction with contains_point to select data points from an image.
In contrast to Lasso, LassoSelector is written with an interface similar to RectangleSelector and SpanSelector, and will continue to interact with the axes until disconnected.
Example usage:
The parent axes for the widget.
Whenever the lasso is released, the onselect function is called and passed the vertices of the selected path.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the line is drawn, see matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams.
The mouse buttons used for rectangle selection. Default is None, which corresponds to all buttons.
[Deprecated]
Deprecated since version 3.5:
[Deprecated]
Deprecated since version 3.5:


[Deprecated]
Deprecated since version 3.5:


Bases: object
Some widgets, like the cursor, draw onto the canvas, and this is not desirable under all circumstances, like when the toolbar is in zoom-to-rect mode and drawing a rectangle. To avoid this, a widget can acquire a canvas' lock with canvas.widgetlock(widget) before drawing on the canvas; this will prevent other widgets from doing so at the same time (if they also try to acquire the lock first).
Return whether drawing is available to o.
Return whether o owns this lock.
Return whether the lock is currently held by an owner.
Release the lock from o.


Return whether drawing is available to o.


Return whether the lock is currently held by an owner.


Bases: matplotlib.widgets.Widget
Provide a vertical (default) and/or horizontal line cursor shared between multiple axes.
For the cursor to remain responsive you must keep a reference to it.
The FigureCanvas that contains all the axes.
The Axes to attach the cursor to.
Use blitting for faster drawing if supported by the backend.
Whether to draw the horizontal line.
Whether to draw the vertical line.
Line2D properties that control the appearance of the lines. See also axhline.
See Multicursor.
Clear the cursor.
Connect events.
Disconnect events.


Bases: matplotlib.widgets._SelectorWidget
Select a polygon region of an axes.
Place vertices with each mouse click, and make the selection by completing the polygon (clicking on the first vertex). Once drawn individual vertices can be moved by clicking and dragging with the left mouse button, or removed by clicking the right mouse button.
In addition, the following modifier keys can be used:
For the selector to remain responsive you must keep a reference to it.
The parent axes for the widget.
When a polygon is completed or modified after completion, the onselect function is called and passed a list of the vertices as (xdata, ydata) tuples.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the line is drawn, see matplotlib.lines.Line2D for valid properties. Default:
dict(color='k', linestyle='-', linewidth=2, alpha=0.5)
Artist properties for the markers drawn at the vertices of the polygon. See the marker arguments in matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams except for the default value of markeredgecolor which will be the same as the color property in props.
A vertex is selected (to complete the polygon or to move a vertex) if the mouse click is within grab_range pixels of the vertex.
If only one point remains after removing points, the selector reverts to an incomplete state and you can start drawing a new polygon from the existing point.
Polygon Selector
Cursor move event handler and validator.
The polygon vertices, as a list of (x, y) pairs.


Cursor move event handler and validator.


Bases: matplotlib.widgets.AxesWidget
A GUI neutral radio button.
For the buttons to remain responsive you must keep a reference to this object.
Connect to the RadioButtons with the on_clicked method.
The parent axes for the widget.
The color of the selected button.
The button labels.
The buttons.
The label text of the currently selected button.
Add radio buttons to an Axes.
The axes to add the buttons to.
The button labels.
The index of the initially selected button.
The color of the selected button.
Remove the observer with connection id cid.
Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.
Select button with number index.
Callbacks will be triggered if eventson is True.


Remove the observer with connection id cid.


Connect the callback function func to button click events.
Returns a connection id, which can be used to disconnect the callback.


Select button with number index.
Callbacks will be triggered if eventson is True.


Bases: matplotlib.widgets.SliderBase
A slider representing a range of floating point values. Defines the min and max of the range via the val attribute as a tuple of (min, max).
Create a slider that defines a range contained within [valmin, valmax] in axes ax. For the slider to remain responsive you must maintain a reference to it. Call on_changed() to connect to the slider event.
Slider value.
The Axes to put the slider in.
Slider label.
The minimum value of the slider.
The maximum value of the slider.
The initial positions of the slider. If None the initial positions will be at the 25th and 75th percentiles of the range.
%-format string used to format the slider values. If None, a ScalarFormatter is used instead.
Whether the slider interval is closed on the bottom.
Whether the slider interval is closed on the top.
If True the slider can be dragged by the mouse.
If given, the slider will snap to multiples of valstep.
The orientation of the slider.
The color of the background track. The track is accessible for further styling via the track attribute.
Properties of the slider handles. Default values are
Key
Value
Default
Description
facecolor
color
'white'
The facecolor of the slider handles.
edgecolor
color
'.75'
The edgecolor of the slider handles.
size
int
10
The size of the slider handles in points.
Other values will be transformed as marker{foo} and passed to the Line2D constructor. e.g. handle_style = {'style'='x'} will result in markerstyle = 'x'.
Additional kwargs are passed on to self.poly which is the Polygon that draws the slider knob. See the Polygon documentation for valid property names (facecolor, edgecolor, alpha, etc.).
Connect func as callback function to changes of the slider value.
Function to call when slider is changed. The function must accept a numpy array with shape (2,) as its argument.
Connection id (which can be used to disconnect func).
Set the lower value of the slider to max.
Set the lower value of the slider to min.
Set slider value to val.


Connect func as callback function to changes of the slider value.
Function to call when slider is changed. The function must accept a numpy array with shape (2,) as its argument.
Connection id (which can be used to disconnect func).


Set the lower value of the slider to max.


Set the lower value of the slider to min.


Bases: matplotlib.widgets._SelectorWidget
Select a rectangular region of an axes.
For the cursor to remain responsive you must keep a reference to it.
Press and release events triggered at the same coordinates outside the selection will clear the selector, except when ignore_event_outside=True.
The parent axes for the widget.
A callback function that is called after a release event and the selection is created, changed or removed. It must have the signature:
where eclick and erelease are the mouse click and release MouseEvents that start and complete the selection.
Selections with an x-span less than or equal to minspanx are removed (when already existing) or cancelled.
Selections with an y-span less than or equal to minspanx are removed (when already existing) or cancelled.
Whether to use blitting for faster drawing (if supported by the backend).
Properties with which the rectangle is drawn. See matplotlib.patches.Patch for valid properties. Default:
dict(facecolor='red', edgecolor='black', alpha=0.2, fill=True)
Whether to interpret minspanx and minspany in data or in pixel coordinates.
Button(s) that trigger rectangle selection.
Distance in pixels within which the interactive tool handles can be activated.
Properties with which the interactive handles (marker artists) are drawn. See the marker arguments in matplotlib.lines.Line2D for valid properties. Default values are defined in mpl.rcParams except for the default value of markeredgecolor which will be the same as the edgecolor property in props.
Whether to draw a set of handles that allow interaction with the widget after it is drawn.
Keyboard modifiers which affect the widget's behavior. Values amend the defaults.
"square" and "center" can be combined.
If True, the widget can be moved by clicking anywhere within its bounds.
If True, the event triggered outside the span selector will be ignored.
See also: Rectangle and ellipse selectors
Center of rectangle.
Corners of rectangle from lower left, moving clockwise.
Midpoint of rectangle edges from left, moving anti-clockwise.
Return (xmin, xmax, ymin, ymax).
Return an array of shape (2, 5) containing the x (RectangleSelector.geometry[1, :]) and y (RectangleSelector.geometry[0, :]) coordinates of the four corners of the rectangle starting and ending in the top left corner.