| |
- __builtin__.object
-
- TransformNode
-
- BboxBase
-
- Bbox
- TransformedBbox
- Transform
-
- AffineBase
-
- Affine2DBase
-
- Affine2D
- BboxTransform
- BboxTransformFrom
- BboxTransformTo
- BlendedAffine2D
- CompositeAffine2D
- IdentityTransform
- ScaledTranslation
- BlendedGenericTransform
- CompositeGenericTransform
- TransformWrapper
- TransformedPath
class Affine2D(Affine2DBase) |
|
A mutable 2D affine transformation. |
|
- Method resolution order:
- Affine2D
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __cmp__(self, other)
- __init__(self, matrix=None)
- 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.
- __repr__(self)
- __str__ = __repr__(self)
- clear(self)
- Reset the underlying matrix to the identity transform.
- get_matrix(self)
- Get the underlying transformation matrix as a 3x3 numpy array::
a c e
b d f
0 0 1
- rotate(self, theta)
- Add a rotation (in radians) to this transform in place.
Returns self, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
and :meth:`scale`.
- rotate_around(self, x, y, theta)
- Add a rotation (in radians) around the point (x, y) in place.
Returns self, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
and :meth:`scale`.
- rotate_deg(self, degrees)
- Add a rotation (in degrees) to this transform in place.
Returns self, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
and :meth:`scale`.
- rotate_deg_around(self, x, y, degrees)
- Add a rotation (in degrees) around the point (x, y) in place.
Returns self, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
and :meth:`scale`.
- scale(self, sx, sy=None)
- Adds a scale in place.
If sy is None, the same scale is applied in both the x- and
y-directions.
Returns self, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
and :meth:`scale`.
- set(self, other)
- Set this transformation from the frozen copy of another
:class:`Affine2DBase` object.
- set_matrix(self, mtx)
- Set the underlying transformation matrix from a 3x3 numpy array::
a c e
b d f
0 0 1
- translate(self, tx, ty)
- Adds a translation in place.
Returns self, so this method can easily be chained with more
calls to :meth:`rotate`, :meth:`rotate_deg, :meth:`translate`
and :meth:`scale`.
Static methods defined here:
- from_values(a, b, c, d, e, f)
- (staticmethod) Create a new Affine2D instance from the given
values::
a c e
b d f
0 0 1
- identity()
- (staticmethod) Return a new :class:`Affine2D` object that is
the identity transform.
Unless this transform will be mutated later on, consider using
the faster :class:`IdentityTransform` class instead.
Data descriptors defined here:
- is_separable
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class Affine2DBase(AffineBase) |
|
The base class of all 2D affine transformations.
2D affine transformations are performed using a 3x3 numpy array::
a c e
b d f
0 0 1
This class provides the read-only interface. For a mutable 2D
affine transformation, use :class:`Affine2D`.
Subclasses of this class will generally only need to override a
constructor and 'get_matrix' that generates a custom 3x3 matrix. |
|
- Method resolution order:
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods defined here:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data descriptors defined here:
- is_separable
Data and other attributes defined here:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- __init__(self)
- get_affine(self)
- Get the affine part of this transform.
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class AffineBase(Transform) |
|
The base class of all affine transformations of any number of
dimensions. |
|
- Method resolution order:
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __array__(self, *args, **kwargs)
- __init__(self)
- get_affine(self)
- Get the affine part of this transform.
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes defined here:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- transform(self, values)
- Performs the transformation on the given array of values.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine(self, values)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Data and other attributes inherited from Transform:
- has_inverse = False
- input_dims = None
- is_separable = False
- output_dims = None
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class Bbox(BboxBase) |
|
A mutable bounding box. |
|
- Method resolution order:
- Bbox
- BboxBase
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, points)
- points: a 2x2 numpy array of the form [[x0, y0], [x1, y1]]
If you need to create a :class:`Bbox` object from another form
of data, consider the static methods unit, from_bounds and
from_extents.
- __repr__(self)
- __str__ = __repr__(self)
- get_points(self)
- Get the points of the bounding box directly as a numpy array
of the form: [[x0, y0], [x1, y1]].
- ignore(self, value)
- Set whether the existing bounds of the box should be ignored
by subsequent calls to :meth:`update_from_data` or
:meth:`update_from_data_xy`.
value:
- When True, subsequent calls to :meth:`update_from_data`
will ignore the existing bounds of the :class:`Bbox`.
- When False, subsequent calls to :meth:`update_from_data`
will include the existing bounds of the :class:`Bbox`.
- set(self, other)
- Set this bounding box from the "frozen" bounds of another Bbox.
- set_points(self, points)
- Set the points of the bounding box directly from a numpy array
of the form: [[x0, y0], [x1, y1]]. No error checking
is performed, as this method is mainly for internal use.
- update_from_data(self, x, y, ignore=None)
- Update the bounds of the :class:`Bbox` based on the passed in
data.
x: a numpy array of x-values
y: a numpy array of y-values
ignore:
- when True, ignore the existing bounds of the Bbox.
- when False, include the existing bounds of the Bbox.
- when None, use the last value passed to :meth:`ignore`.
- update_from_data_xy(self, xy, ignore=None)
- Update the bounds of the :class:`Bbox` based on the passed in
data.
xy: a numpy array of 2D points
ignore:
- when True, ignore the existing bounds of the Bbox.
- when False, include the existing bounds of the Bbox.
- when None, use the last value passed to :meth:`ignore`.
Static methods defined here:
- from_bounds(x0, y0, width, height)
- (staticmethod) Create a new :class:`Bbox` from x0, y0, width
and height.
width and height may be negative.
- from_extents(*args)
- (staticmethod) Create a new Bbox from left, bottom, right and
top.
The y-axis increases upwards.
- unit()
- (staticmethod) Create a new unit :class:`Bbox` from (0, 0) to
(1, 1).
Data descriptors defined here:
- bounds
- intervalx
- intervaly
- minpos
- minposx
- minposy
- p0
- p1
- x0
- x1
- y0
- y1
Methods inherited from BboxBase:
- __array__(self, *args, **kwargs)
- anchored(self, c, container=None)
- Return a copy of the Bbox, shifted to position c within a
container.
c: may be either:
* a sequence (cx, cy) where cx, cy range
from 0 to 1, where 0 is left or bottom and 1 is right or top
* a string:
- C for centered
- S for bottom-center
- SE for bottom-left
- E for left
- etc.
Optional argument *container* is the box within which the :class:`Bbox`
is positioned; it defaults to the initial :class:`Bbox`.
- contains(self, x, y)
- Returns True if (x, y) is a coordinate inside the bounding
box or on its edge.
- containsx(self, x)
- Returns True if x is between or equal to :attr:`x0` and
:attr:`x1`.
- containsy(self, y)
- Returns True if y is between or equal to :attr:`y0` and
:attr:`y1`.
- corners(self)
- Return an array of points which are the four corners of this
rectangle. For example, if this :class:`Bbox` is defined by
the points (*a*, *b*) and (*c*, *d*), :meth:`corners` returns
(*a*, *b*), (*a*, *d*), (*c*, *b*) and (*c*, *d*).
- count_contains(self, vertices)
- Count the number of vertices contained in the Bbox.
vertices is a Nx2 numpy array.
- count_overlaps(self, bboxes)
- Count the number of bounding boxes that overlap this one.
bboxes is a sequence of :class:`BboxBase` objects
- expanded(self, sw, sh)
- Return a new :class:`Bbox` which is this :class:`Bbox`
expanded around its center by the given factors *sw* and
*sh*.
- frozen(self)
- :class:`TransformNode` is 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.
- fully_contains(self, x, y)
- Returns True if (x, y) is a coordinate inside the bounding
box, but not on its edge.
- fully_containsx(self, x)
- Returns True if x is between but not equal to :attr:`x0` and
:attr:`x1`.
- fully_containsy(self, y)
- Returns True if y is between but not equal to :attr:`y0` and
:attr:`y1`.
- fully_overlaps(self, other)
- Returns True if this bounding box overlaps with the given
bounding box *other*, but not on its edge alone.
- inverse_transformed(self, transform)
- Return a new :class:`Bbox` object, statically transformed by
the inverse of the given transform.
- is_unit(self)
- Returns True if the Bbox is the unit bounding box from (0, 0)
to (1, 1).
- overlaps(self, other)
- Returns True if this bounding box overlaps with the given
bounding box *other*.
- padded(self, p)
- Return a new :class:`Bbox` that is padded on all four sides by
the given value.
- rotated(self, radians)
- Return a new bounding box that bounds a rotated version of
this bounding box by the given radians. The new bounding box
is still aligned with the axes, of course.
- shrunk(self, mx, my)
- Return a copy of the :class:`Bbox`, shurnk by the factor mx in
the *x* direction and the factor my in the *y* direction. The
lower left corner of the box remains unchanged. Normally mx
and my will be less than 1, but this is not enforced.
- shrunk_to_aspect(self, box_aspect, container=None, fig_aspect=1.0)
- Return a copy of the :class:`Bbox`, shrunk so that it is as
large as it can be while having the desired aspect ratio,
*box_aspect*. If the box coordinates are relative---that
is, fractions of a larger box such as a figure---then the
physical aspect ratio of that figure is specified with
*fig_aspect*, so that *box_aspect* can also be given as a
ratio of the absolute dimensions, not the relative dimensions.
- splitx(self, *args)
- e.g., ``bbox.splitx(f1, f2, ...)``
Returns a list of new :class:`Bbox` objects formed by
splitting the original one with vertical lines at fractional
positions *f1*, *f2*, ...
- splity(self, *args)
- e.g., ``bbox.splitx(f1, f2, ...)``
Returns a list of new :class:`Bbox` objects formed by
splitting the original one with horizontal lines at fractional
positions *f1*, *f2*, ...
- transformed(self, transform)
- Return a new :class:`Bbox` object, statically transformed by
the given transform.
- translated(self, tx, ty)
- Return a copy of the :class:`Bbox`, statically translated by
tx and ty.
Static methods inherited from BboxBase:
- union(bboxes)
- Return a :class:`Bbox` that contains all of the given bboxes.
Data descriptors inherited from BboxBase:
- extents
- (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`).
- height
- (property) The height of the bounding box. It may be negative if :attr:`y1` <
:attr:`y0`.
- max
- (property) :attr:`max` is the top-right corner of the bounding box.
- min
- (property) :attr:`min` is the bottom-left corner of the bounding box.
- size
- (property) The width and height of the bounding box. May be negative, in the same
way as :attr:`width` and :attr:`height`.
- width
- (property) The width of the bounding box. It may be negative if :attr:`x1` <
:attr:`x0`.
- xmax
- (property) :attr:`xmax` is the right edge of the bounding box.
- xmin
- (property) :attr:`xmin` is the left edge of the bounding box.
- ymax
- (property) :attr:`ymax` is the top edge of the bounding box.
- ymin
- (property) :attr:`ymin` is the bottom edge of the bounding box.
Data and other attributes inherited from BboxBase:
- coefs = {'C': (0.5, 0.5), 'E': (1.0, 0.5), 'N': (0.5, 1.0), 'NE': (1.0, 1.0), 'NW': (0, 1.0), 'S': (0.5, 0), 'SE': (1.0, 0), 'SW': (0, 0), 'W': (0, 0.5)}
- is_affine = True
- is_bbox = True
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- pass_through = False
|
class BboxBase(TransformNode) |
|
This is the base class of all bounding boxes, and provides
read-only access to its data. A mutable bounding box is provided
by the :class:`Bbox` class.
The canonical representation is as two points, with no
restrictions on their ordering. Convenience properties are
provided to get the left, bottom, right and top edges and width
and height, but these are not stored explicity. |
|
- Method resolution order:
- BboxBase
- TransformNode
- __builtin__.object
Methods defined here:
- __array__(self, *args, **kwargs)
- anchored(self, c, container=None)
- Return a copy of the Bbox, shifted to position c within a
container.
c: may be either:
* a sequence (cx, cy) where cx, cy range
from 0 to 1, where 0 is left or bottom and 1 is right or top
* a string:
- C for centered
- S for bottom-center
- SE for bottom-left
- E for left
- etc.
Optional argument *container* is the box within which the :class:`Bbox`
is positioned; it defaults to the initial :class:`Bbox`.
- contains(self, x, y)
- Returns True if (x, y) is a coordinate inside the bounding
box or on its edge.
- containsx(self, x)
- Returns True if x is between or equal to :attr:`x0` and
:attr:`x1`.
- containsy(self, y)
- Returns True if y is between or equal to :attr:`y0` and
:attr:`y1`.
- corners(self)
- Return an array of points which are the four corners of this
rectangle. For example, if this :class:`Bbox` is defined by
the points (*a*, *b*) and (*c*, *d*), :meth:`corners` returns
(*a*, *b*), (*a*, *d*), (*c*, *b*) and (*c*, *d*).
- count_contains(self, vertices)
- Count the number of vertices contained in the Bbox.
vertices is a Nx2 numpy array.
- count_overlaps(self, bboxes)
- Count the number of bounding boxes that overlap this one.
bboxes is a sequence of :class:`BboxBase` objects
- expanded(self, sw, sh)
- Return a new :class:`Bbox` which is this :class:`Bbox`
expanded around its center by the given factors *sw* and
*sh*.
- frozen(self)
- :class:`TransformNode` is 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.
- fully_contains(self, x, y)
- Returns True if (x, y) is a coordinate inside the bounding
box, but not on its edge.
- fully_containsx(self, x)
- Returns True if x is between but not equal to :attr:`x0` and
:attr:`x1`.
- fully_containsy(self, y)
- Returns True if y is between but not equal to :attr:`y0` and
:attr:`y1`.
- fully_overlaps(self, other)
- Returns True if this bounding box overlaps with the given
bounding box *other*, but not on its edge alone.
- get_points(self)
- inverse_transformed(self, transform)
- Return a new :class:`Bbox` object, statically transformed by
the inverse of the given transform.
- is_unit(self)
- Returns True if the Bbox is the unit bounding box from (0, 0)
to (1, 1).
- overlaps(self, other)
- Returns True if this bounding box overlaps with the given
bounding box *other*.
- padded(self, p)
- Return a new :class:`Bbox` that is padded on all four sides by
the given value.
- rotated(self, radians)
- Return a new bounding box that bounds a rotated version of
this bounding box by the given radians. The new bounding box
is still aligned with the axes, of course.
- shrunk(self, mx, my)
- Return a copy of the :class:`Bbox`, shurnk by the factor mx in
the *x* direction and the factor my in the *y* direction. The
lower left corner of the box remains unchanged. Normally mx
and my will be less than 1, but this is not enforced.
- shrunk_to_aspect(self, box_aspect, container=None, fig_aspect=1.0)
- Return a copy of the :class:`Bbox`, shrunk so that it is as
large as it can be while having the desired aspect ratio,
*box_aspect*. If the box coordinates are relative---that
is, fractions of a larger box such as a figure---then the
physical aspect ratio of that figure is specified with
*fig_aspect*, so that *box_aspect* can also be given as a
ratio of the absolute dimensions, not the relative dimensions.
- splitx(self, *args)
- e.g., ``bbox.splitx(f1, f2, ...)``
Returns a list of new :class:`Bbox` objects formed by
splitting the original one with vertical lines at fractional
positions *f1*, *f2*, ...
- splity(self, *args)
- e.g., ``bbox.splitx(f1, f2, ...)``
Returns a list of new :class:`Bbox` objects formed by
splitting the original one with horizontal lines at fractional
positions *f1*, *f2*, ...
- transformed(self, transform)
- Return a new :class:`Bbox` object, statically transformed by
the given transform.
- translated(self, tx, ty)
- Return a copy of the :class:`Bbox`, statically translated by
tx and ty.
Static methods defined here:
- union(bboxes)
- Return a :class:`Bbox` that contains all of the given bboxes.
Data descriptors defined here:
- bounds
- (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`).
- extents
- (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`).
- height
- (property) The height of the bounding box. It may be negative if :attr:`y1` <
:attr:`y0`.
- intervalx
- (property) :attr:`intervalx` is the pair of *x* coordinates that define the
bounding box. It is not guaranteed to be sorted from left to right.
- intervaly
- (property) :attr:`intervaly` is the pair of *y* coordinates that define the
bounding box. It is not guaranteed to be sorted from bottom to top.
- max
- (property) :attr:`max` is the top-right corner of the bounding box.
- min
- (property) :attr:`min` is the bottom-left corner of the bounding box.
- p0
- (property) :attr:`p0` is the first pair of (*x*, *y*) coordinates that
define the bounding box. It is not guaranteed to be the bottom-left
corner. For that, use :attr:`min`.
- p1
- (property) :attr:`p1` is the second pair of (*x*, *y*) coordinates that
define the bounding box. It is not guaranteed to be the top-right
corner. For that, use :attr:`max`.
- size
- (property) The width and height of the bounding box. May be negative, in the same
way as :attr:`width` and :attr:`height`.
- width
- (property) The width of the bounding box. It may be negative if :attr:`x1` <
:attr:`x0`.
- x0
- (property) :attr:`x0` is the first of the pair of *x* coordinates that
define the bounding box. :attr:`x0` is not guaranteed to be
less than :attr:`x1`. If you require that, use :attr:`xmin`.
- x1
- (property) :attr:`x1` is the second of the pair of *x* coordinates that
define the bounding box. :attr:`x1` is not guaranteed to be
greater than :attr:`x0`. If you require that, use :attr:`xmax`.
- xmax
- (property) :attr:`xmax` is the right edge of the bounding box.
- xmin
- (property) :attr:`xmin` is the left edge of the bounding box.
- y0
- (property) :attr:`y0` is the first of the pair of *y* coordinates that
define the bounding box. :attr:`y0` is not guaranteed to be
less than :attr:`y1`. If you require that, use :attr:`ymin`.
- y1
- (property) :attr:`y1` is the second of the pair of *y* coordinates that
define the bounding box. :attr:`y1` is not guaranteed to be
greater than :attr:`y0`. If you require that, use :attr:`ymax`.
- ymax
- (property) :attr:`ymax` is the top edge of the bounding box.
- ymin
- (property) :attr:`ymin` is the bottom edge of the bounding box.
Data and other attributes defined here:
- coefs = {'C': (0.5, 0.5), 'E': (1.0, 0.5), 'N': (0.5, 1.0), 'NE': (1.0, 1.0), 'NW': (0, 1.0), 'S': (0.5, 0), 'SE': (1.0, 0), 'SW': (0, 0), 'W': (0, 0.5)}
- is_affine = True
- is_bbox = True
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- __init__(self)
- Creates a new TransformNode.
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- pass_through = False
|
class BboxTransform(Affine2DBase) |
|
BboxTransform linearly transforms points from one Bbox to another Bbox. |
|
- Method resolution order:
- BboxTransform
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, boxin, boxout)
- Create a new BboxTransform that linearly transforms points
from boxin to boxout.
- __repr__(self)
- __str__ = __repr__(self)
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
Data and other attributes defined here:
- is_separable = True
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class BboxTransformFrom(Affine2DBase) |
|
BboxTransform linearly transforms points from a given
:class:`Bbox` to the unit bounding box. |
|
- Method resolution order:
- BboxTransformFrom
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, boxin)
- __repr__(self)
- __str__ = __repr__(self)
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
Data and other attributes defined here:
- is_separable = True
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class BboxTransformTo(Affine2DBase) |
|
BboxTransformTo is a transformation that linearly transforms
points from the unit bounding box to a given :class:`Bbox`. |
|
- Method resolution order:
- BboxTransformTo
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, boxout)
- Create a new :class:`BboxTransformTo` that linearly transforms
points from the unit bounding box to boxout.
- __repr__(self)
- __str__ = __repr__(self)
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
Data and other attributes defined here:
- is_separable = True
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class BlendedAffine2D(Affine2DBase) |
|
A "blended" transform uses one transform for the x-direction, and
another transform for the y-direction.
This version is an optimization for the case where both child
transforms are of type Affine2DBase. |
|
- Method resolution order:
- BlendedAffine2D
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, x_transform, y_transform)
- Create a new "blended" transform using x_transform to
transform the x-axis and y_transform to transform the y_axis.
Both x_transform and y_transform must be 2D affine transforms.
You will generally not call this constructor directly but use
the :func:`blended_transform_factory` function instead, which
can determine automatically which kind of blended transform to
create.
- __repr__(self)
- __str__ = __repr__(self)
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
Data and other attributes defined here:
- is_separable = True
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class BlendedGenericTransform(Transform) |
|
A "blended" transform uses one transform for the x-direction, and
another transform for the y-direction.
This "generic" version can handle any given child transform in the
x- and y-directions. |
|
- Method resolution order:
- BlendedGenericTransform
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, x_transform, y_transform)
- Create a new "blended" transform using x_transform to
transform the x-axis and y_transform to transform the y_axis.
You will generally not call this constructor directly but use
the :func:`blended_transform_factory` function instead, which
can determine automatically which kind of blended transform to
create.
- __repr__(self)
- __str__ = __repr__(self)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- get_affine(self)
- Get the affine part of this transform.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- transform(self, points)
- Performs the transformation on the given array of values.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
Data descriptors defined here:
- is_affine
Data and other attributes defined here:
- input_dims = 2
- is_separable = True
- output_dims = 2
- pass_through = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __array__(self, *args, **kwargs)
- Used by C/C++ -based backends to get at the array matrix data.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
|
class CompositeAffine2D(Affine2DBase) |
|
A composite transform formed by applying transform a then transform b.
This version is an optimization that handles the case where both a
and b are 2D affines. |
|
- Method resolution order:
- CompositeAffine2D
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, a, b)
- Create a new composite transform that is the result of
applying transform a then transform b.
Both a and b must be instances of :class:`Affine2DBase`.
You will generally not call this constructor directly but use
the :func:`composite_transform_factory` function instead,
which can automatically choose the best kind of composite
transform instance to create.
- __repr__(self)
- __str__ = __repr__(self)
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data descriptors inherited from Affine2DBase:
- is_separable
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class CompositeGenericTransform(Transform) |
|
A composite transform formed by applying transform a then transform b.
This "generic" version can handle any two arbitrary transformations. |
|
- Method resolution order:
- CompositeGenericTransform
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, a, b)
- Create a new composite transform that is the result of
applying transform a then transform b.
You will generally not call this constructor directly but use
the :func:`composite_transform_factory` function instead,
which can automatically choose the best kind of composite
transform instance to create.
- __repr__(self)
- __str__ = __repr__(self)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- get_affine(self)
- Get the affine part of this transform.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- transform(self, points)
- Performs the transformation on the given array of values.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data descriptors defined here:
- is_affine
- is_separable
Data and other attributes defined here:
- pass_through = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __array__(self, *args, **kwargs)
- Used by C/C++ -based backends to get at the array matrix data.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Data and other attributes inherited from Transform:
- has_inverse = False
- input_dims = None
- output_dims = None
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
|
class IdentityTransform(Affine2DBase) |
|
A special class that does on thing, the identity transform, in a
fast way. |
|
- Method resolution order:
- IdentityTransform
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __repr__(self)
- __str__ = __repr__(self)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- get_affine(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
- inverted = get_affine(self)
- transform(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- transform_non_affine = transform(self, points)
- transform_path(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_affine = transform_path(self, path)
- transform_path_non_affine = transform_path(self, path)
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data descriptors inherited from Affine2DBase:
- is_separable
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- __init__(self)
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class ScaledTranslation(Affine2DBase) |
|
A transformation that translates by xt and yt, after xt and yt
have been transformaed by the given transform scale_trans. |
|
- Method resolution order:
- ScaledTranslation
- Affine2DBase
- AffineBase
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, xt, yt, scale_trans)
- __repr__(self)
- __str__ = __repr__(self)
- get_matrix(self)
- Get the underlying transformation matrix as a numpy array.
Methods inherited from Affine2DBase:
- __array__(self, *args, **kwargs)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- to_values(self)
- Return the values of the matrix as a sequence (a,b,c,d,e,f)
- transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine = transform(self, points)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Static methods inherited from Affine2DBase:
- matrix_from_values(a, b, c, d, e, f)
- (staticmethod) Create a new transformation matrix as a 3x3
numpy array of the form::
a c e
b d f
0 0 1
Data descriptors inherited from Affine2DBase:
- is_separable
Data and other attributes inherited from Affine2DBase:
- input_dims = 2
- output_dims = 2
Methods inherited from AffineBase:
- get_affine(self)
- Get the affine part of this transform.
- transform_non_affine(self, points)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
Data and other attributes inherited from AffineBase:
- is_affine = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
Data and other attributes inherited from Transform:
- has_inverse = False
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
- pass_through = False
|
class Transform(TransformNode) |
|
The base class of all TransformNodes that actually perform a
transformation.
All non-affine transformations should be subclasses of this class.
New affine transformations should be subclasses of
:class:`Affine2D`.
Subclasses of this class should override the following members (at
minimum):
- :attr:`input_dims`
- :attr:`output_dims`
- :meth:`transform`
- :attr:`is_separable`
- :attr:`has_inverse`
- :meth:`inverted` (if :meth:`has_inverse` can return True)
If the transform needs to do something non-standard with
:class:`mathplotlib.path.Path` objects, such as adding curves
where there were once line segments, it should override:
- :meth:`transform_path` |
|
- Method resolution order:
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __array__(self, *args, **kwargs)
- Used by C/C++ -based backends to get at the array matrix data.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- get_affine(self)
- Get the affine part of this transform.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- transform(self, values)
- Performs the transformation on the given array of values.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine(self, values)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_non_affine(self, values)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Data and other attributes defined here:
- has_inverse = False
- input_dims = None
- is_separable = False
- output_dims = None
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- __init__(self)
- Creates a new TransformNode.
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_affine = False
- is_bbox = False
- pass_through = False
|
class TransformNode(__builtin__.object) |
|
:class:`TransformNode` is 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. |
|
Methods defined here:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- __init__(self)
- Creates a new TransformNode.
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors defined here:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes defined here:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_affine = False
- is_bbox = False
- pass_through = False
|
class TransformWrapper(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.
Note that :class:`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. |
|
- Method resolution order:
- TransformWrapper
- Transform
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, child)
- child: A Transform instance. This child may later be replaced
with :meth:`set`.
- __repr__(self)
- __str__ = __repr__(self)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- set(self, child)
- 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.
Data descriptors defined here:
- has_inverse
- is_affine
- is_separable
Data and other attributes defined here:
- pass_through = True
Methods inherited from Transform:
- __add__(self, other)
- Composes two transforms together such that self is followed by other.
- __array__(self, *args, **kwargs)
- Used by C/C++ -based backends to get at the array matrix data.
- __radd__(self, other)
- Composes two transforms together such that self is followed by other.
- get_affine(self)
- Get the affine part of this transform.
- inverted(self)
- Return the corresponding inverse transformation.
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.
``x === inverted().transform(transform(x))``
- transform(self, values)
- Performs the transformation on the given array of values.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_affine(self, values)
- Performs 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)``.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_non_affine(self, values)
- Performs only the non-affine part of the 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.
Accepts a numpy array of shape (N x :attr:`input_dims`) and
returns a numpy array of shape (N x :attr:`output_dims`).
- transform_path(self, path)
- Returns a transformed copy of path.
path: a Path instance.
In some cases, this transform may insert curves into the path
that began as line segments.
- transform_path_affine(self, path)
- Returns a copy of path, transformed only by the affine part of
this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_path_non_affine(self, path)
- Returns a copy of path, transformed only by the non-affine
part of this transform.
path: a Path instance
``transform_path(path)`` is equivalent to
``transform_path_affine(transform_path_non_affine(values))``.
- transform_point(self, point)
- A convenience function that returns the transformed copy of a
single point.
The point is given as a sequence of length :attr:`input_dims`.
The transformed point is returned as a sequence of length
:attr:`output_dims`.
Data and other attributes inherited from Transform:
- input_dims = None
- output_dims = None
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_bbox = False
|
class TransformedBbox(BboxBase) |
|
A :class:`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. |
|
- Method resolution order:
- TransformedBbox
- BboxBase
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, bbox, transform)
- bbox: a child bbox
transform: a 2D transform
- __repr__(self)
- __str__ = __repr__(self)
- get_points(self)
- Get the points of the bounding box directly as a numpy array
of the form: [[x0, y0], [x1, y1]].
Methods inherited from BboxBase:
- __array__(self, *args, **kwargs)
- anchored(self, c, container=None)
- Return a copy of the Bbox, shifted to position c within a
container.
c: may be either:
* a sequence (cx, cy) where cx, cy range
from 0 to 1, where 0 is left or bottom and 1 is right or top
* a string:
- C for centered
- S for bottom-center
- SE for bottom-left
- E for left
- etc.
Optional argument *container* is the box within which the :class:`Bbox`
is positioned; it defaults to the initial :class:`Bbox`.
- contains(self, x, y)
- Returns True if (x, y) is a coordinate inside the bounding
box or on its edge.
- containsx(self, x)
- Returns True if x is between or equal to :attr:`x0` and
:attr:`x1`.
- containsy(self, y)
- Returns True if y is between or equal to :attr:`y0` and
:attr:`y1`.
- corners(self)
- Return an array of points which are the four corners of this
rectangle. For example, if this :class:`Bbox` is defined by
the points (*a*, *b*) and (*c*, *d*), :meth:`corners` returns
(*a*, *b*), (*a*, *d*), (*c*, *b*) and (*c*, *d*).
- count_contains(self, vertices)
- Count the number of vertices contained in the Bbox.
vertices is a Nx2 numpy array.
- count_overlaps(self, bboxes)
- Count the number of bounding boxes that overlap this one.
bboxes is a sequence of :class:`BboxBase` objects
- expanded(self, sw, sh)
- Return a new :class:`Bbox` which is this :class:`Bbox`
expanded around its center by the given factors *sw* and
*sh*.
- frozen(self)
- :class:`TransformNode` is 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.
- fully_contains(self, x, y)
- Returns True if (x, y) is a coordinate inside the bounding
box, but not on its edge.
- fully_containsx(self, x)
- Returns True if x is between but not equal to :attr:`x0` and
:attr:`x1`.
- fully_containsy(self, y)
- Returns True if y is between but not equal to :attr:`y0` and
:attr:`y1`.
- fully_overlaps(self, other)
- Returns True if this bounding box overlaps with the given
bounding box *other*, but not on its edge alone.
- inverse_transformed(self, transform)
- Return a new :class:`Bbox` object, statically transformed by
the inverse of the given transform.
- is_unit(self)
- Returns True if the Bbox is the unit bounding box from (0, 0)
to (1, 1).
- overlaps(self, other)
- Returns True if this bounding box overlaps with the given
bounding box *other*.
- padded(self, p)
- Return a new :class:`Bbox` that is padded on all four sides by
the given value.
- rotated(self, radians)
- Return a new bounding box that bounds a rotated version of
this bounding box by the given radians. The new bounding box
is still aligned with the axes, of course.
- shrunk(self, mx, my)
- Return a copy of the :class:`Bbox`, shurnk by the factor mx in
the *x* direction and the factor my in the *y* direction. The
lower left corner of the box remains unchanged. Normally mx
and my will be less than 1, but this is not enforced.
- shrunk_to_aspect(self, box_aspect, container=None, fig_aspect=1.0)
- Return a copy of the :class:`Bbox`, shrunk so that it is as
large as it can be while having the desired aspect ratio,
*box_aspect*. If the box coordinates are relative---that
is, fractions of a larger box such as a figure---then the
physical aspect ratio of that figure is specified with
*fig_aspect*, so that *box_aspect* can also be given as a
ratio of the absolute dimensions, not the relative dimensions.
- splitx(self, *args)
- e.g., ``bbox.splitx(f1, f2, ...)``
Returns a list of new :class:`Bbox` objects formed by
splitting the original one with vertical lines at fractional
positions *f1*, *f2*, ...
- splity(self, *args)
- e.g., ``bbox.splitx(f1, f2, ...)``
Returns a list of new :class:`Bbox` objects formed by
splitting the original one with horizontal lines at fractional
positions *f1*, *f2*, ...
- transformed(self, transform)
- Return a new :class:`Bbox` object, statically transformed by
the given transform.
- translated(self, tx, ty)
- Return a copy of the :class:`Bbox`, statically translated by
tx and ty.
Static methods inherited from BboxBase:
- union(bboxes)
- Return a :class:`Bbox` that contains all of the given bboxes.
Data descriptors inherited from BboxBase:
- bounds
- (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`).
- extents
- (property) Returns (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`).
- height
- (property) The height of the bounding box. It may be negative if :attr:`y1` <
:attr:`y0`.
- intervalx
- (property) :attr:`intervalx` is the pair of *x* coordinates that define the
bounding box. It is not guaranteed to be sorted from left to right.
- intervaly
- (property) :attr:`intervaly` is the pair of *y* coordinates that define the
bounding box. It is not guaranteed to be sorted from bottom to top.
- max
- (property) :attr:`max` is the top-right corner of the bounding box.
- min
- (property) :attr:`min` is the bottom-left corner of the bounding box.
- p0
- (property) :attr:`p0` is the first pair of (*x*, *y*) coordinates that
define the bounding box. It is not guaranteed to be the bottom-left
corner. For that, use :attr:`min`.
- p1
- (property) :attr:`p1` is the second pair of (*x*, *y*) coordinates that
define the bounding box. It is not guaranteed to be the top-right
corner. For that, use :attr:`max`.
- size
- (property) The width and height of the bounding box. May be negative, in the same
way as :attr:`width` and :attr:`height`.
- width
- (property) The width of the bounding box. It may be negative if :attr:`x1` <
:attr:`x0`.
- x0
- (property) :attr:`x0` is the first of the pair of *x* coordinates that
define the bounding box. :attr:`x0` is not guaranteed to be
less than :attr:`x1`. If you require that, use :attr:`xmin`.
- x1
- (property) :attr:`x1` is the second of the pair of *x* coordinates that
define the bounding box. :attr:`x1` is not guaranteed to be
greater than :attr:`x0`. If you require that, use :attr:`xmax`.
- xmax
- (property) :attr:`xmax` is the right edge of the bounding box.
- xmin
- (property) :attr:`xmin` is the left edge of the bounding box.
- y0
- (property) :attr:`y0` is the first of the pair of *y* coordinates that
define the bounding box. :attr:`y0` is not guaranteed to be
less than :attr:`y1`. If you require that, use :attr:`ymin`.
- y1
- (property) :attr:`y1` is the second of the pair of *y* coordinates that
define the bounding box. :attr:`y1` is not guaranteed to be
greater than :attr:`y0`. If you require that, use :attr:`ymax`.
- ymax
- (property) :attr:`ymax` is the top edge of the bounding box.
- ymin
- (property) :attr:`ymin` is the bottom edge of the bounding box.
Data and other attributes inherited from BboxBase:
- coefs = {'C': (0.5, 0.5), 'E': (1.0, 0.5), 'N': (0.5, 1.0), 'NE': (1.0, 1.0), 'NW': (0, 1.0), 'S': (0.5, 0), 'SE': (1.0, 0), 'SW': (0, 0), 'W': (0, 0.5)}
- is_affine = True
- is_bbox = True
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- pass_through = False
|
class TransformedPath(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. |
|
- Method resolution order:
- TransformedPath
- TransformNode
- __builtin__.object
Methods defined here:
- __init__(self, path, transform)
- Create a new TransformedPath from the given path and transform.
- get_affine(self)
- get_fully_transformed_path(self)
- Return a fully-transformed copy of the child path.
- get_transformed_path_and_affine(self)
- 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.
- get_transformed_points_and_affine(self)
- 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.
Methods inherited from TransformNode:
- __copy__(self, *args)
- __deepcopy__ = __copy__(self, *args)
- frozen(self)
- Returns a frozen copy of this transform node. The frozen copy
will not update when its children change. Useful for storing
a previously known state of a transform where copy.deepcopy()
might normally be used.
- invalidate(self)
- Invalidate this transform node and all of its ancestors.
Should be called any time the transform changes.
- set_children(self, *children)
- 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.
- write_graphviz(self, fobj, highlight=[])
Data descriptors inherited from TransformNode:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from TransformNode:
- INVALID = 3
- INVALID_AFFINE = 2
- INVALID_NON_AFFINE = 1
- is_affine = False
- is_bbox = False
- pass_through = False
| |