mpl.figure.Affine2D

class mpl.figure.Affine2D(matrix=None, **kwargs)[source]

A mutable 2D affine transformation.

__init__(matrix=None, **kwargs)[source]

Initialize an Affine transform from a 3x3 numpy float array:

a c e
b d f
0 0 1

If matrix is None, initialize with the identity transform.

Methods

__init__([matrix]) Initialize an Affine transform from a 3x3 numpy float array:
clear() Reset the underlying matrix to the identity transform.
contains_branch(other) Return whether the given transform is a sub-tree of this transform.
contains_branch_seperately(other_transform) Returns whether the given branch is a sub-tree of this transform on each seperate dimension.
from_values(a, b, c, d, e, f) (staticmethod) Create a new Affine2D instance from the given
frozen() Returns a frozen copy of this transform node.
get_affine() Get the affine part of this transform.
get_matrix() Get the underlying transformation matrix as a 3x3 numpy array:
identity() (staticmethod) Return a new Affine2D object that is
invalidate() Invalidate this TransformNode and triggers an invalidation of its ancestors.
inverted() Return the corresponding inverse transformation.
matrix_from_values(a, b, c, d, e, f) (staticmethod) Create a new transformation matrix as a 3x3
rotate(theta) Add a rotation (in radians) to this transform in place.
rotate_around(x, y, theta) Add a rotation (in radians) around the point (x, y) in place.
rotate_deg(degrees) Add a rotation (in degrees) to this transform in place.
rotate_deg_around(x, y, degrees) Add a rotation (in degrees) around the point (x, y) in place.
scale(sx[, sy]) Adds a scale in place.
set(other) Set this transformation from the frozen copy of another Affine2DBase object.
set_children(*children) Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform.
set_matrix(mtx) Set the underlying transformation matrix from a 3x3 numpy array:
skew(xShear, yShear) Adds a skew in place.
skew_deg(xShear, yShear) Adds a skew in place.
to_values() Return the values of the matrix as a sequence (a,b,c,d,e,f)
transform(values) Performs the transformation on the given array of values.
transform_affine(points) Performs only the affine part of this transformation on the given array of values.
transform_angles(angles, pts[, radians, pushoff]) Performs transformation on a set of angles anchored at specific locations.
transform_bbox(bbox) Transform the given bounding box.
transform_non_affine(points) Performs only the non-affine part of the transformation.
transform_path(path) Returns a transformed path.
transform_path_affine(path) Returns a path, transformed only by the affine part of this transform.
transform_path_non_affine(path) Returns a path, transformed only by the non-affine part of this transform.
transform_point(point) A convenience function that returns the transformed copy of a single point.
translate(tx, ty) Adds a translation in place.

Attributes

INVALID
INVALID_AFFINE
INVALID_NON_AFFINE
depth Returns the number of transforms which have been chained together to form this Transform instance.
has_inverse
input_dims
is_affine
is_bbox
is_separable
output_dims
pass_through