A mutable bounding box.
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]])
It is recommended to always specify
ignoreexplicitly. If not, the default value ofignorecan be changed at any time by code with access to your Bbox, for example using the method~.Bbox.ignore.
Properties of the ``null`` bbox
The current behavior of
:None:None:`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!)
See :>>> Bbox.union([Bbox([[0, 0], [0, 0]]), Bbox.null()]) Bbox([[-inf, -inf], [inf, inf]])
The following pages refer to to this document either explicitly or contain code examples using this.
matplotlib.transforms.BboxBase.paddedmatplotlib.axes._axes.Axes.broken_barhmatplotlib.artist.DrawingArea.setmatplotlib.artist.Patch.setmatplotlib.transforms.Bbox.update_from_pathmatplotlib.patches.RegularPolygon.__init__matplotlib.axes._axes.Axes.coherematplotlib.transforms.BboxBase.count_containsmatplotlib.artist.ThetaAxis.setmatplotlib.artist.AsteriskPolygonCollection.setmatplotlib.artist.QuadMesh.setmatplotlib.pyplot.errorbarmatplotlib.table.Tablematplotlib.pyplot.angle_spectrummatplotlib.artist.CirclePolygon.setmatplotlib.axes._axes.Axes.quivermatplotlib.artist.TextArea.setmatplotlib.pyplot.pcolormatplotlib.artist.YTick.setmatplotlib.patches.Wedge.__init__matplotlib.axes._axes.Axes.magnitude_spectrummatplotlib.artist.BrokenBarHCollection.setmatplotlib.pyplot.fill_betweenmatplotlib.axes._base._AxesBase.__init__matplotlib.patches.Polygon.__init__matplotlib.artist.StepPatch.setmatplotlib.artist.OffsetImage.setmatplotlib.pyplot.axvlinematplotlib.transforms.BboxTransformToMaxOnlymatplotlib.pyplot.axvspanmatplotlib.artist.RadialAxis.setmatplotlib.axes._axes.Axes.axhlinematplotlib.artist.BboxImage.setmatplotlib.patches.PathPatch.__init__matplotlib.artist.PathCollection.setmatplotlib.axes._axes.Axes.barbsmatplotlib.artist.Table.setmatplotlib.artist.PatchCollection.setmatplotlib.patches.FancyArrowPatch.__init__matplotlib.artist.Ellipse.setmatplotlib.transforms.Bbox.update_from_data_xymatplotlib.text.Text.get_window_extentmatplotlib.patches.FancyArrow.__init__matplotlib.artist.AnchoredOffsetbox.setmatplotlib.axes._axes.Axes.phase_spectrummatplotlib.axes._axes.Axes.axhspanmatplotlib.transforms.BboxBasematplotlib.axes._base._AxesBase.get_positionmatplotlib.artist.Shadow.setmatplotlib.pyplot.barbsmatplotlib.patches.Patch.__init__matplotlib.artist.Rectangle.setmatplotlib.patches.Circle.__init__matplotlib.figure.Figure.__init__matplotlib.figure.FigureBase.add_axesmatplotlib.patches.Arrow.__init__matplotlib.artist.HPacker.setmatplotlib.artist.RegularPolygon.setmatplotlib.artist.FancyArrowPatch.setmatplotlib.transforms.BboxBase.shrunkmatplotlib.axes._axes.Axes.fill_betweenmatplotlib.text.Annotation.__init__matplotlib.transforms.BboxTransformTomatplotlib.artist.AxesImage.setmatplotlib.artist.PolyCollection.setmatplotlib.artist.LineCollection.setmatplotlib.lines.Line2D.__init__matplotlib.backend_bases.GraphicsContextBase.get_clip_rectanglematplotlib.pyplot.psdmatplotlib.pyplot.plotmatplotlib.axes._axes.Axes.annotatematplotlib.patches.FancyBboxPatch.get_bboxmatplotlib.transforms.BboxBase.splitxmatplotlib.transforms.LockableBboxmatplotlib.transforms.TransformedBboxmatplotlib.artist.Axis.setmatplotlib.transforms.BboxBase.shrunk_to_aspectmatplotlib.artist.Line2D.setmatplotlib.patches.FancyBboxPatch.__init__matplotlib.axes._axes.Axes.arrowmatplotlib.artist.VPacker.setmatplotlib.transforms.BboxBase.splitymatplotlib.artist._make_class_factory.<locals>.class_factory.<locals>.subcls.setmatplotlib.pyplot.barmatplotlib.artist.LambertAxes.setmatplotlib.artist.Axes.setmatplotlib.artist.Tick.setmatplotlib.pyplot.axhspanmatplotlib.transforms.Bbox.update_from_data_ymatplotlib.artist.PcolorImage.setmatplotlib.figure.FigureBase.get_tightbboxmatplotlib.pyplot.csdmatplotlib.artist.CircleCollection.setmatplotlib.artist.Legend.setmatplotlib.axes._axes.Axes.hexbinmatplotlib.backend_bases.GraphicsContextBase.set_clip_rectanglematplotlib.artist.SubFigure.setmatplotlib.axes._axes.Axes.spymatplotlib.pyplot.tablematplotlib.artist.Figure.setmatplotlib.axes._axes.Axes.fill_betweenxmatplotlib.axes._axes.Axes.pcolormatplotlib.patches.CirclePolygon.__init__matplotlib.patches.Patch.get_extentsmatplotlib.quiver.Barbs.__init__matplotlib.artist.Wedge.setmatplotlib.pyplot.pcolormeshmatplotlib.artist.FigureImage.setmatplotlib.pyplot.hexbinmatplotlib.transforms.BboxTransformFrommatplotlib.artist.TriMesh.setmatplotlib.artist.PaddedBox.setmatplotlib.artist.Collection.setmatplotlib.artist.Spine.setmatplotlib.transforms.BboxBase.transformedmatplotlib.transforms.BboxBase.anchoredmatplotlib.axes._axes.Axes.barmatplotlib.patches.Ellipse.__init__matplotlib.patches.StepPatch.__init__matplotlib.artist.AnchoredText.setmatplotlib.patches.Rectangle.__init__matplotlib.axes._axes.Axes.indicate_insetmatplotlib.patches.Shadow.__init__matplotlib.spines.Spine.__init__matplotlib.pyplot.plot_datematplotlib.artist.Arrow.setmatplotlib.pyplot.spymatplotlib.artist.Annulus.setmatplotlib.artist.Polygon.setmatplotlib.transforms.BboxBase.rotatedmatplotlib.pyplot.axlinematplotlib.transforms.BboxBase.translatedmatplotlib.axes._axes.Axes.pcolormeshmatplotlib.artist.Annotation.setmatplotlib.pyplot.gridmatplotlib.patches.Arc.__init__matplotlib.pyplot.barhmatplotlib.artist._CollectionWithSizes.setmatplotlib.sankey.Sankey.addmatplotlib.artist.RadialTick.setmatplotlib.artist.SecondaryAxis.setmatplotlib.artist.PolarAxes.setmatplotlib.artist.PathPatch.setmatplotlib.axes._axes.Axes.plotmatplotlib.artist.GeoAxes.setmatplotlib.figure.SubFigure.__init__matplotlib.patches.Annulus.__init__matplotlib.artist.EventCollection.setmatplotlib.artist.FigureBase.setmatplotlib.pyplot.fill_betweenxmatplotlib.artist.StarPolygonCollection.setmatplotlib.artist.Cell.setmatplotlib.transforms.Bbox.setmatplotlib.quiver.Quiver.__init__matplotlib.artist.FancyBboxPatch.setmatplotlib.artist.EllipseCollection.setmatplotlib.artist.XTick.setmatplotlib.artist.ConnectionPatch.setmatplotlib.transforms.Bbox.update_from_data_xmatplotlib.artist._ColorbarSpine.setmatplotlib.artist.PackerBase.setmatplotlib.artist.Arc.setmatplotlib.transforms.BboxTransformmatplotlib.artist.Artist.set_clip_boxmatplotlib.axes._axes.Axes.axlinematplotlib.transforms.BboxBase.expandedmatplotlib.path.Path.intersects_bboxmatplotlib.artist.RegularPolyCollection.setmatplotlib.artist.Barbs.setmatplotlib.axes._axes.Axes.axvspanmatplotlib.artist.Circle.setmatplotlib.artist.HammerAxes.setmatplotlib.pyplot.coherematplotlib.artist.ThetaTick.setmatplotlib.figure.FigureBase.gcamatplotlib.artist._ImageBase.setmatplotlib.artist.AuxTransformBox.setmatplotlib.pyplot.subplotmatplotlib.artist.NonUniformImage.setmatplotlib.pyplot.magnitude_spectrummatplotlib.axes._base._AxesBase.gridmatplotlib.axes._axes.Axes.psdmatplotlib.pyplot.phase_spectrummatplotlib.axes._axes.Axes.csdmatplotlib.pyplot.gcamatplotlib.axes._axes.Axes.plot_datematplotlib.pyplot.axesmatplotlib.pyplot.quivermatplotlib.figure.FigureBase.add_subplotmatplotlib.artist._AxLine.setmatplotlib.pyplot.broken_barhmatplotlib.axes._axes.Axes.barhmatplotlib.axes._axes.Axes.angle_spectrummatplotlib.pyplot.annotatematplotlib.axes._axes.Axes.axvlinematplotlib.artist.XAxis.setmatplotlib.artist.FancyArrow.setmatplotlib.artist.MollweideAxes.setmatplotlib.artist.ClabelText.setmatplotlib.pyplot.arrowmatplotlib.pyplot.axhlinematplotlib.artist.QuiverKey.setmatplotlib.artist.OffsetBox.setmatplotlib.axes._axes.Axes.errorbarmatplotlib.patches.Rectangle.get_bboxmatplotlib.artist.Artist.setmatplotlib.artist._AxesBase.setmatplotlib.artist.AitoffAxes.setmatplotlib.artist.AnnotationBbox.setmatplotlib.artist.Quiver.setmatplotlib.artist.YAxis.setHover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them