Module « matplotlib.figure »
Classe « Bbox »
Informations générales
Héritage
builtins.object
TransformNode
BboxBase
Bbox
Définition
class Bbox(BboxBase):
Description [extrait de Bbox.__doc__]
A mutable bounding box.
Examples
--------
**Create from known bounds**
The default constructor takes the boundary "points" ``[[xmin, ymin],
[xmax, ymax]]``.
>>> Bbox([[1, 1], [3, 7]])
Bbox([[1.0, 1.0], [3.0, 7.0]])
Alternatively, a Bbox can be created from the flattened points array, the
so-called "extents" ``(xmin, ymin, xmax, ymax)``
>>> Bbox.from_extents(1, 1, 3, 7)
Bbox([[1.0, 1.0], [3.0, 7.0]])
or from the "bounds" ``(xmin, ymin, width, height)``.
>>> Bbox.from_bounds(1, 1, 2, 6)
Bbox([[1.0, 1.0], [3.0, 7.0]])
**Create from collections of points**
The "empty" object for accumulating Bboxs is the null bbox, which is a
stand-in for the empty set.
>>> Bbox.null()
Bbox([[inf, inf], [-inf, -inf]])
Adding points to the null bbox will give you the bbox of those points.
>>> box = Bbox.null()
>>> box.update_from_data_xy([[1, 1]])
>>> box
Bbox([[1.0, 1.0], [1.0, 1.0]])
>>> box.update_from_data_xy([[2, 3], [3, 2]], ignore=False)
>>> box
Bbox([[1.0, 1.0], [3.0, 3.0]])
Setting ``ignore=True`` is equivalent to starting over from a null bbox.
>>> box.update_from_data_xy([[1, 1]], ignore=True)
>>> box
Bbox([[1.0, 1.0], [1.0, 1.0]])
.. warning::
It is recommended to always specify ``ignore`` explicitly. If not, the
default value of ``ignore`` can be changed at any time by code with
access to your Bbox, for example using the method `~.Bbox.ignore`.
**Properties of the ``null`` bbox**
.. note::
The current behavior of `Bbox.null()` may be surprising as it does
not have all of the properties of the "empty set", and as such does
not behave like a "zero" object in the mathematical sense. We may
change that in the future (with a deprecation period).
The null bbox is the identity for intersections
>>> Bbox.intersection(Bbox([[1, 1], [3, 7]]), Bbox.null())
Bbox([[1.0, 1.0], [3.0, 7.0]])
except with itself, where it returns the full space.
>>> Bbox.intersection(Bbox.null(), Bbox.null())
Bbox([[-inf, -inf], [inf, inf]])
A union containing null will always return the full space (not the other
set!)
>>> Bbox.union([Bbox([[0, 0], [0, 0]]), Bbox.null()])
Bbox([[-inf, -inf], [inf, inf]])
Constructeur(s)
Liste des attributs statiques
coefs | {'C': (0.5, 0.5), 'SW': (0, 0), 'S': (0.5, 0), 'SE': (1.0, 0), 'E': (1.0, 0.5), 'NE': (1.0, 1.0), 'N': (0.5, 1.0), 'NW': (0, 1.0), 'W': (0, 0.5)} |
INVALID | 3 |
INVALID_AFFINE | 2 |
INVALID_NON_AFFINE | 1 |
is_affine | True |
is_bbox | True |
pass_through | False |
Liste des propriétés
bounds | Return (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`). [extrait de __doc__] |
extents | Return (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`). [extrait de __doc__] |
height | The (signed) height of the bounding box. [extrait de __doc__] |
intervalx | |
intervaly | |
max | The top-right corner of the bounding box. [extrait de __doc__] |
min | The bottom-left corner of the bounding box. [extrait de __doc__] |
minpos | |
minposx | |
minposy | |
p0 | |
p1 | |
size | The (signed) width and height of the bounding box. [extrait de __doc__] |
width | The (signed) width of the bounding box. [extrait de __doc__] |
x0 | |
x1 | |
xmax | The right edge of the bounding box. [extrait de __doc__] |
xmin | The left edge of the bounding box. [extrait de __doc__] |
y0 | |
y1 | |
ymax | The top edge of the bounding box. [extrait de __doc__] |
ymin | The bottom edge of the bounding box. [extrait de __doc__] |
Liste des opérateurs
Opérateurs hérités de la classe object
__eq__,
__ge__,
__gt__,
__le__,
__lt__,
__ne__
Liste des méthodes
Toutes les méthodes
Méthodes d'instance
Méthodes statiques
Méthodes dépréciées
__format__(self, fmt) |
|
__repr__(self) |
|
__str__(self) |
|
from_bounds(x0, y0, width, height) |
|
from_extents(*args, minpos=None) |
|
get_points(self) |
|
ignore(self, value) |
|
mutated(self) |
Return whether the bbox has changed since init. [extrait de mutated.__doc__] |
mutatedx(self) |
Return whether the x-limits have changed since init. [extrait de mutatedx.__doc__] |
mutatedy(self) |
Return whether the y-limits have changed since init. [extrait de mutatedy.__doc__] |
null() |
Create a new null `Bbox` from (inf, inf) to (-inf, -inf). [extrait de null.__doc__] |
set(self, other) |
|
set_points(self, points) |
|
unit() |
Create a new unit `Bbox` from (0, 0) to (1, 1). [extrait de unit.__doc__] |
update_from_data_xy(self, xy, ignore=None, updatex=True, updatey=True) |
|
update_from_path(self, path, ignore=None, updatex=True, updatey=True) |
|
Méthodes héritées de la classe BboxBase
__array__, __init_subclass__, __subclasshook__, anchored, contains, containsx, containsy, corners, count_contains, count_overlaps, expanded, frozen, fully_contains, fully_containsx, fully_containsy, fully_overlaps, intersection, inverse_transformed, overlaps, padded, rotated, shrunk, shrunk_to_aspect, splitx, splity, transformed, translated, union
Méthodes héritées de la classe TransformNode
__copy__, __deepcopy__, __getstate__, __setstate__, invalidate, set_children
Méthodes héritées de la classe object
__delattr__,
__dir__,
__getattribute__,
__hash__,
__reduce__,
__reduce_ex__,
__setattr__,
__sizeof__
Améliorations / Corrections
Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.
Emplacement :
Description des améliorations :