Participer au site avec un Tip
Rechercher
 

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 :

Vous êtes un professionnel et vous avez besoin d'une formation ? Coder avec une
Intelligence Artificielle
Voir le programme détaillé
Module « matplotlib.artist »

Classe « Bbox »

Informations générales

Héritage

builtins.object
    TransformNode
        BboxBase
            Bbox

Définition

class Bbox(BboxBase):

help(Bbox)

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)

Signature du constructeur Description
__init__(self, points, **kwargs)

Liste des attributs statiques

Nom de l'attribut Valeur
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)}
is_affineTrue
is_bboxTrue
pass_throughFalse

Liste des propriétés

Nom de la propriétéDescription
boundsReturn (:attr:`x0`, :attr:`y0`, :attr:`width`, :attr:`height`). [extrait de bounds.__doc__]
extentsReturn (:attr:`x0`, :attr:`y0`, :attr:`x1`, :attr:`y1`). [extrait de extents.__doc__]
heightThe (signed) height of the bounding box. [extrait de height.__doc__]
intervalx
intervaly
maxThe top-right corner of the bounding box. [extrait de max.__doc__]
minThe bottom-left corner of the bounding box. [extrait de min.__doc__]
minpos
minposx
minposy
p0
p1
sizeThe (signed) width and height of the bounding box. [extrait de size.__doc__]
widthThe (signed) width of the bounding box. [extrait de width.__doc__]
x0
x1
xmaxThe right edge of the bounding box. [extrait de xmax.__doc__]
xminThe left edge of the bounding box. [extrait de xmin.__doc__]
y0
y1
ymaxThe top edge of the bounding box. [extrait de ymax.__doc__]
yminThe bottom edge of the bounding box. [extrait de ymin.__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
Signature de la méthodeDescription
__format__(self, fmt)
__repr__(self)
__str__(self)
from_bounds(x0, y0, width, height)
from_extents(*args, minpos=None)
frozen(self)
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_x(self, x, ignore=None)
update_from_data_xy(self, xy, ignore=None, updatex=True, updatey=True)
update_from_data_y(self, y, ignore=None)
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, fully_contains, fully_containsx, fully_containsy, fully_overlaps, intersection, overlaps, padded, rotated, shrunk, shrunk_to_aspect, splitx, splity, transformed, translated, union

Méthodes héritées de la classe TransformNode

__copy__, __getstate__, __setstate__, invalidate, set_children

Méthodes héritées de la classe object

__delattr__, __dir__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __setattr__, __sizeof__

Vous êtes un professionnel et vous avez besoin d'une formation ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé