mpl.figure.Bbox¶
-
class
mpl.figure.Bbox(points, **kwargs)[source]¶ A mutable bounding box.
-
__init__(points, **kwargs)[source]¶ points: a 2x2 numpy array of the form [[x0, y0], [x1, y1]]
If you need to create a
Bboxobject from another form of data, consider the static methodsunit(),from_bounds()andfrom_extents().
-
Methods¶
__init__(points, **kwargs) |
points: a 2x2 numpy array of the form [[x0, y0], [x1, y1]] |
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. |
from_bounds(x0, y0, width, height) |
(staticmethod) Create a new Bbox from x0, y0, |
from_extents(*args) |
(staticmethod) Create a new Bbox from left, bottom, |
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() |
Get the points of the bounding box directly as a numpy array of the form: [[x0, y0], [x1, y1]]. |
ignore(value) |
Set whether the existing bounds of the box should be ignored by subsequent calls to update_from_data() or update_from_data_xy(). |
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). |
mutated() |
return whether the bbox has changed since init |
mutatedx() |
return whether the x-limits have changed since init |
mutatedy() |
return whether the y-limits have changed since init |
null() |
(staticmethod) Create a new null Bbox from (inf, inf) to |
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(other) |
Set this bounding box from the “frozen” bounds of another Bbox. |
set_children(*children) |
Set the children of the transform, to let the invalidation system know which transforms can invalidate this transform. |
set_points(points) |
Set the points of the bounding box directly from a numpy array of the form: [[x0, y0], [x1, y1]]. |
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. |
unit() |
(staticmethod) Create a new unit Bbox from (0, 0) to |
update_from_data(x, y[, ignore]) |
Update the bounds of the Bbox based on the passed in data. |
update_from_data_xy(xy[, ignore, updatex, ...]) |
Update the bounds of the Bbox based on the passed in data. |
update_from_path(path[, ignore, updatex, ...]) |
Update the bounds of the Bbox based on the passed in data. |
Attributes¶
INVALID |
|
INVALID_AFFINE |
|
INVALID_NON_AFFINE |
|
bounds |
|
coefs |
|
extents |
(property) Returns (x0, y0, x1, |
height |
(property) The height of the bounding box. It may be negative if |
intervalx |
|
intervaly |
|
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 |
minpos |
|
minposx |
|
minposy |
|
p0 |
|
p1 |
|
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 |
|
x1 |
|
xmax |
(property) xmax is the right edge of the bounding box. |
xmin |
(property) xmin is the left edge of the bounding box. |
y0 |
|
y1 |
|
ymax |
(property) ymax is the top edge of the bounding box. |
ymin |
(property) ymin is the bottom edge of the bounding box. |