mpl.offsetbox.BboxBase¶
-
class
mpl.offsetbox.BboxBase(shorthand_name=None)[source]¶ 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
Bboxclass.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 explicitly.
-
__init__(shorthand_name=None)¶ Creates a new
TransformNode.- shorthand_name - a string representing the “name” of this
- transform. The name carries no significance
other than to improve the readability of
str(transform)when DEBUG=True.
-
Methods¶
__init__([shorthand_name]) |
Creates a new TransformNode. |
anchored(c[, container]) |
Return a copy of the Bbox, shifted to position c within a container. |
contains(x, y) |
Returns True if (x, y) is a coordinate inside the bounding box or on its edge. |
containsx(x) |
Returns True if x is between or equal to x0 and x1. |
containsy(y) |
Returns True if y is between or equal to y0 and y1. |
corners() |
Return an array of points which are the four corners of this rectangle. |
count_contains(vertices) |
Count the number of vertices contained in the Bbox. |
count_overlaps(bboxes) |
Count the number of bounding boxes that overlap this one. |
expanded(sw, sh) |
Return a new Bbox which is this Bbox expanded around its center by the given factors sw and sh. |
frozen() |
TransformNode is the base class for anything that |
fully_contains(x, y) |
Returns True if (x, y) is a coordinate inside the bounding box, but not on its edge. |
fully_containsx(x) |
Returns True if x is between but not equal to x0 and x1. |
fully_containsy(y) |
Returns True if y is between but not equal to y0 and y1. |
fully_overlaps(other) |
Returns True if this bounding box overlaps with the given bounding box other, but not on its edge alone. |
get_points() |
|
intersection(bbox1, bbox2) |
Return the intersection of the two bboxes or None if they do not intersect. |
invalidate() |
Invalidate this TransformNode and triggers an invalidation of its ancestors. |
inverse_transformed(transform) |
Return a new Bbox object, statically transformed by the inverse of the given transform. |
is_unit() |
Returns True if the Bbox is the unit bounding box from (0, 0) to (1, 1). |
overlaps(other) |
Returns True if this bounding box overlaps with the given bounding box other. |
padded(p) |
Return a new Bbox that is padded on all four sides by the given value. |
rotated(radians) |
Return a new bounding box that bounds a rotated version of this bounding box by the given radians. |
set_children(*children) |
Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform. |
shrunk(mx, my) |
Return a copy of the Bbox, shrunk by the factor mx in the x direction and the factor my in the y direction. |
shrunk_to_aspect(box_aspect[, container, ...]) |
Return a copy of the Bbox, shrunk so that it is as large as it can be while having the desired aspect ratio, box_aspect. |
splitx(*args) |
e.g., bbox.splitx(f1, f2, ...) |
splity(*args) |
e.g., bbox.splitx(f1, f2, ...) |
transformed(transform) |
Return a new Bbox object, statically transformed by the given transform. |
translated(tx, ty) |
Return a copy of the Bbox, statically translated by tx and ty. |
union(bboxes) |
Return a Bbox that contains all of the given bboxes. |
Attributes¶
INVALID |
|
INVALID_AFFINE |
|
INVALID_NON_AFFINE |
|
bounds |
(property) Returns (x0, y0, width, |
coefs |
|
extents |
(property) Returns (x0, y0, x1, |
height |
(property) The height of the bounding box. It may be negative if |
intervalx |
(property) intervalx is the pair of x coordinates that define |
intervaly |
(property) intervaly is the pair of y coordinates that define |
is_affine |
|
is_bbox |
|
max |
(property) max is the top-right corner of the bounding box. |
min |
(property) min is the bottom-left corner of the bounding |
p0 |
(property) p0 is the first pair of (x, y) coordinates |
p1 |
(property) p1 is the second pair of (x, y) coordinates |
pass_through |
|
size |
(property) The width and height of the bounding box. May be negative, |
width |
(property) The width of the bounding box. It may be negative if |
x0 |
(property) x0 is the first of the pair of x coordinates that |
x1 |
(property) x1 is the second of the pair of x coordinates |
xmax |
(property) xmax is the right edge of the bounding box. |
xmin |
(property) xmin is the left edge of the bounding box. |
y0 |
(property) y0 is the first of the pair of y coordinates that |
y1 |
(property) y1 is the second of the pair of y coordinates |
ymax |
(property) ymax is the top edge of the bounding box. |
ymin |
(property) ymin is the bottom edge of the bounding box. |