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
ignore
explicitly. If not, the default value ofignore
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
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.padded
matplotlib.axes._axes.Axes.broken_barh
matplotlib.artist.DrawingArea.set
matplotlib.artist.Patch.set
matplotlib.transforms.Bbox.update_from_path
matplotlib.patches.RegularPolygon.__init__
matplotlib.axes._axes.Axes.cohere
matplotlib.transforms.BboxBase.count_contains
matplotlib.artist.ThetaAxis.set
matplotlib.artist.AsteriskPolygonCollection.set
matplotlib.artist.QuadMesh.set
matplotlib.pyplot.errorbar
matplotlib.table.Table
matplotlib.pyplot.angle_spectrum
matplotlib.artist.CirclePolygon.set
matplotlib.axes._axes.Axes.quiver
matplotlib.artist.TextArea.set
matplotlib.pyplot.pcolor
matplotlib.artist.YTick.set
matplotlib.patches.Wedge.__init__
matplotlib.axes._axes.Axes.magnitude_spectrum
matplotlib.artist.BrokenBarHCollection.set
matplotlib.pyplot.fill_between
matplotlib.axes._base._AxesBase.__init__
matplotlib.patches.Polygon.__init__
matplotlib.artist.StepPatch.set
matplotlib.artist.OffsetImage.set
matplotlib.pyplot.axvline
matplotlib.transforms.BboxTransformToMaxOnly
matplotlib.pyplot.axvspan
matplotlib.artist.RadialAxis.set
matplotlib.axes._axes.Axes.axhline
matplotlib.artist.BboxImage.set
matplotlib.patches.PathPatch.__init__
matplotlib.artist.PathCollection.set
matplotlib.axes._axes.Axes.barbs
matplotlib.artist.Table.set
matplotlib.artist.PatchCollection.set
matplotlib.patches.FancyArrowPatch.__init__
matplotlib.artist.Ellipse.set
matplotlib.transforms.Bbox.update_from_data_xy
matplotlib.text.Text.get_window_extent
matplotlib.patches.FancyArrow.__init__
matplotlib.artist.AnchoredOffsetbox.set
matplotlib.axes._axes.Axes.phase_spectrum
matplotlib.axes._axes.Axes.axhspan
matplotlib.transforms.BboxBase
matplotlib.axes._base._AxesBase.get_position
matplotlib.artist.Shadow.set
matplotlib.pyplot.barbs
matplotlib.patches.Patch.__init__
matplotlib.artist.Rectangle.set
matplotlib.patches.Circle.__init__
matplotlib.figure.Figure.__init__
matplotlib.figure.FigureBase.add_axes
matplotlib.patches.Arrow.__init__
matplotlib.artist.HPacker.set
matplotlib.artist.RegularPolygon.set
matplotlib.artist.FancyArrowPatch.set
matplotlib.transforms.BboxBase.shrunk
matplotlib.axes._axes.Axes.fill_between
matplotlib.text.Annotation.__init__
matplotlib.transforms.BboxTransformTo
matplotlib.artist.AxesImage.set
matplotlib.artist.PolyCollection.set
matplotlib.artist.LineCollection.set
matplotlib.lines.Line2D.__init__
matplotlib.backend_bases.GraphicsContextBase.get_clip_rectangle
matplotlib.pyplot.psd
matplotlib.pyplot.plot
matplotlib.axes._axes.Axes.annotate
matplotlib.patches.FancyBboxPatch.get_bbox
matplotlib.transforms.BboxBase.splitx
matplotlib.transforms.LockableBbox
matplotlib.transforms.TransformedBbox
matplotlib.artist.Axis.set
matplotlib.transforms.BboxBase.shrunk_to_aspect
matplotlib.artist.Line2D.set
matplotlib.patches.FancyBboxPatch.__init__
matplotlib.axes._axes.Axes.arrow
matplotlib.artist.VPacker.set
matplotlib.transforms.BboxBase.splity
matplotlib.artist._make_class_factory.<locals>.class_factory.<locals>.subcls.set
matplotlib.pyplot.bar
matplotlib.artist.LambertAxes.set
matplotlib.artist.Axes.set
matplotlib.artist.Tick.set
matplotlib.pyplot.axhspan
matplotlib.transforms.Bbox.update_from_data_y
matplotlib.artist.PcolorImage.set
matplotlib.figure.FigureBase.get_tightbbox
matplotlib.pyplot.csd
matplotlib.artist.CircleCollection.set
matplotlib.artist.Legend.set
matplotlib.axes._axes.Axes.hexbin
matplotlib.backend_bases.GraphicsContextBase.set_clip_rectangle
matplotlib.artist.SubFigure.set
matplotlib.axes._axes.Axes.spy
matplotlib.pyplot.table
matplotlib.artist.Figure.set
matplotlib.axes._axes.Axes.fill_betweenx
matplotlib.axes._axes.Axes.pcolor
matplotlib.patches.CirclePolygon.__init__
matplotlib.patches.Patch.get_extents
matplotlib.quiver.Barbs.__init__
matplotlib.artist.Wedge.set
matplotlib.pyplot.pcolormesh
matplotlib.artist.FigureImage.set
matplotlib.pyplot.hexbin
matplotlib.transforms.BboxTransformFrom
matplotlib.artist.TriMesh.set
matplotlib.artist.PaddedBox.set
matplotlib.artist.Collection.set
matplotlib.artist.Spine.set
matplotlib.transforms.BboxBase.transformed
matplotlib.transforms.BboxBase.anchored
matplotlib.axes._axes.Axes.bar
matplotlib.patches.Ellipse.__init__
matplotlib.patches.StepPatch.__init__
matplotlib.artist.AnchoredText.set
matplotlib.patches.Rectangle.__init__
matplotlib.axes._axes.Axes.indicate_inset
matplotlib.patches.Shadow.__init__
matplotlib.spines.Spine.__init__
matplotlib.pyplot.plot_date
matplotlib.artist.Arrow.set
matplotlib.pyplot.spy
matplotlib.artist.Annulus.set
matplotlib.artist.Polygon.set
matplotlib.transforms.BboxBase.rotated
matplotlib.pyplot.axline
matplotlib.transforms.BboxBase.translated
matplotlib.axes._axes.Axes.pcolormesh
matplotlib.artist.Annotation.set
matplotlib.pyplot.grid
matplotlib.patches.Arc.__init__
matplotlib.pyplot.barh
matplotlib.artist._CollectionWithSizes.set
matplotlib.sankey.Sankey.add
matplotlib.artist.RadialTick.set
matplotlib.artist.SecondaryAxis.set
matplotlib.artist.PolarAxes.set
matplotlib.artist.PathPatch.set
matplotlib.axes._axes.Axes.plot
matplotlib.artist.GeoAxes.set
matplotlib.figure.SubFigure.__init__
matplotlib.patches.Annulus.__init__
matplotlib.artist.EventCollection.set
matplotlib.artist.FigureBase.set
matplotlib.pyplot.fill_betweenx
matplotlib.artist.StarPolygonCollection.set
matplotlib.artist.Cell.set
matplotlib.transforms.Bbox.set
matplotlib.quiver.Quiver.__init__
matplotlib.artist.FancyBboxPatch.set
matplotlib.artist.EllipseCollection.set
matplotlib.artist.XTick.set
matplotlib.artist.ConnectionPatch.set
matplotlib.transforms.Bbox.update_from_data_x
matplotlib.artist._ColorbarSpine.set
matplotlib.artist.PackerBase.set
matplotlib.artist.Arc.set
matplotlib.transforms.BboxTransform
matplotlib.artist.Artist.set_clip_box
matplotlib.axes._axes.Axes.axline
matplotlib.transforms.BboxBase.expanded
matplotlib.path.Path.intersects_bbox
matplotlib.artist.RegularPolyCollection.set
matplotlib.artist.Barbs.set
matplotlib.axes._axes.Axes.axvspan
matplotlib.artist.Circle.set
matplotlib.artist.HammerAxes.set
matplotlib.pyplot.cohere
matplotlib.artist.ThetaTick.set
matplotlib.figure.FigureBase.gca
matplotlib.artist._ImageBase.set
matplotlib.artist.AuxTransformBox.set
matplotlib.pyplot.subplot
matplotlib.artist.NonUniformImage.set
matplotlib.pyplot.magnitude_spectrum
matplotlib.axes._base._AxesBase.grid
matplotlib.axes._axes.Axes.psd
matplotlib.pyplot.phase_spectrum
matplotlib.axes._axes.Axes.csd
matplotlib.pyplot.gca
matplotlib.axes._axes.Axes.plot_date
matplotlib.pyplot.axes
matplotlib.pyplot.quiver
matplotlib.figure.FigureBase.add_subplot
matplotlib.artist._AxLine.set
matplotlib.pyplot.broken_barh
matplotlib.axes._axes.Axes.barh
matplotlib.axes._axes.Axes.angle_spectrum
matplotlib.pyplot.annotate
matplotlib.axes._axes.Axes.axvline
matplotlib.artist.XAxis.set
matplotlib.artist.FancyArrow.set
matplotlib.artist.MollweideAxes.set
matplotlib.artist.ClabelText.set
matplotlib.pyplot.arrow
matplotlib.pyplot.axhline
matplotlib.artist.QuiverKey.set
matplotlib.artist.OffsetBox.set
matplotlib.axes._axes.Axes.errorbar
matplotlib.patches.Rectangle.get_bbox
matplotlib.artist.Artist.set
matplotlib.artist._AxesBase.set
matplotlib.artist.AitoffAxes.set
matplotlib.artist.AnnotationBbox.set
matplotlib.artist.Quiver.set
matplotlib.artist.YAxis.set
Hover 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