classmatplotlib.transforms.Transform(shorthand_name=None)[source]
 
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):  input_dims output_dims transform() 
inverted() (if an inverse exists)  The following attributes may be overridden if the default is unsuitable:  
is_separable (defaults to True for 1D -> 1D transforms, False otherwise) 
has_inverse (defaults to True if inverted() is overridden, False otherwise)  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:  transform_path()   Parameters 
 
shorthand_namestr


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.       __add__(other)[source]
 
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__(*args, **kwargs)[source]
 
Array interface to get at this Transform's affine matrix. 
   classmethod__init_subclass__()[source]
 
This method is called when a class is subclassed. The default implementation does nothing. It may be overridden to extend subclasses. 
   __module__='matplotlib.transforms'

   __sub__(other)[source]
 
Compose self with the inverse of other, cancelling identical terms if any: # In general:
A - B == A + B.inverted()
# (but see note regarding frozen transforms below).

# If A "ends with" B (i.e. A == A' + B for some A') we can cancel
# out B:
(A' + B) - B == A'

# Likewise, if B "starts with" A (B = A + B'), we can cancel out A:
A - (A + B') == B'.inverted() == B'^-1
 Cancellation (rather than naively returning A + B.inverted()) is important for multiple reasons:  It avoids floating-point inaccuracies when computing the inverse of B: B - B is guaranteed to cancel out exactly (resulting in the identity transform), whereas B + B.inverted() may differ by a small epsilon. 
B.inverted() always returns a frozen transform: if one computes A + B + B.inverted() and later mutates B, then B.inverted() won't be updated and the last two terms won't cancel out anymore; on the other hand, A + B - B will always be equal to A even if B is mutated.  
   contains_branch(other)[source]
 
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. 
   contains_branch_seperately(other_transform)[source]
 
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.: x_isdata, y_isdata = trans.contains_branch_seperately(ax.transData)
 
   propertydepth
 
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_affine()[source]
 
Get the affine part of this transform. 
   get_matrix()[source]
 
Get the matrix for the affine part of this transform. 
   has_inverse=False
 
True if this transform has a corresponding inverse transform. 
   input_dims=None
 
The number of input dimensions of this transform. Must be overridden (with integers) in the subclass. 
   inverted()[source]
 
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. 
   is_separable=False
 
True if this transform is separable in the x- and y- dimensions. 
   output_dims=None
 
The number of output dimensions of this transform. Must be overridden (with integers) in the subclass. 
   transform(values)[source]
 
Apply this transformation on the given array of values.  Parameters 
 
valuesarray


The input values as NumPy array of length input_dims or shape (N x input_dims).    Returns 
 array

The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.     
   transform_affine(values)[source]
 
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).  Parameters 
 
valuesarray


The input values as NumPy array of length input_dims or shape (N x input_dims).    Returns 
 array

The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.     
   transform_angles(angles, pts, radians=False, pushoff=1e-05)[source]
 
Transform a set of angles anchored at specific locations.  Parameters 
 
angles(N,) array-like


The angles to transform.  
pts(N, 2) array-like


The points where the angles are anchored.  
radiansbool, default: False


Whether angles are radians or degrees.  
pushofffloat


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.    Returns 
 (N,) array
   
   transform_bbox(bbox)[source]
 
Transform the given bounding box. For smarter transforms including caching (a common requirement in Matplotlib), see TransformedBbox. 
   transform_non_affine(values)[source]
 
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.  Parameters 
 
valuesarray


The input values as NumPy array of length input_dims or shape (N x input_dims).    Returns 
 array

The output values as NumPy array of length input_dims or shape (N x output_dims), depending on the input.     
   transform_path(path)[source]
 
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. 
   transform_path_affine(path)[source]
 
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)). 
   transform_path_non_affine(path)[source]
 
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)). 
   transform_point(point)[source]
 
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.