Skip to content

Commit 31ae0fe

Browse files
authored
Merge pull request matplotlib#26874 from agautam478/collections
Cleaned up the span_where class method from Polycollections.
2 parents ad18e34 + 3f72eca commit 31ae0fe

File tree

8 files changed

+8
-64
lines changed

8 files changed

+8
-64
lines changed

ci/mypy-stubtest-allowlist.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ matplotlib.figure.Figure.set_tight_layout
5252
# 3.7 deprecations
5353
matplotlib.cm.register_cmap
5454
matplotlib.cm.unregister_cmap
55-
matplotlib.collections.PolyCollection.span_where
5655

5756
# 3.8 deprecations
5857
matplotlib.cbook.get_sample_data

doc/api/artist_api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
Inheritance Diagrams
1212
====================
1313

14-
.. inheritance-diagram:: matplotlib.axes._axes.Axes matplotlib.axes._base._AxesBase matplotlib.axis.Axis matplotlib.axis.Tick matplotlib.axis.XAxis matplotlib.axis.XTick matplotlib.axis.YAxis matplotlib.axis.YTick matplotlib.collections.AsteriskPolygonCollection matplotlib.collections.BrokenBarHCollection matplotlib.collections.CircleCollection matplotlib.collections.Collection matplotlib.collections.EllipseCollection matplotlib.collections.EventCollection matplotlib.collections.LineCollection matplotlib.collections.PatchCollection matplotlib.collections.PathCollection matplotlib.collections.PolyCollection matplotlib.collections.QuadMesh matplotlib.collections.RegularPolyCollection matplotlib.collections.StarPolygonCollection matplotlib.collections.TriMesh matplotlib.collections._CollectionWithSizes matplotlib.contour.ClabelText matplotlib.contour.ContourSet matplotlib.contour.QuadContourSet matplotlib.figure.FigureBase matplotlib.figure.Figure matplotlib.figure.SubFigure matplotlib.image.AxesImage matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.NonUniformImage matplotlib.image.PcolorImage matplotlib.image._ImageBase matplotlib.legend.Legend matplotlib.lines.Line2D matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.HPacker matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.PackerBase matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.TextArea matplotlib.offsetbox.VPacker matplotlib.patches.Annulus matplotlib.patches.Arc matplotlib.patches.Arrow matplotlib.patches.Circle matplotlib.patches.CirclePolygon matplotlib.patches.ConnectionPatch matplotlib.patches.Ellipse matplotlib.patches.FancyArrow matplotlib.patches.FancyArrowPatch matplotlib.patches.FancyBboxPatch matplotlib.patches.Patch matplotlib.patches.PathPatch matplotlib.patches.Polygon matplotlib.patches.Rectangle matplotlib.patches.RegularPolygon matplotlib.patches.Shadow matplotlib.patches.StepPatch matplotlib.patches.Wedge matplotlib.projections.geo.AitoffAxes matplotlib.projections.geo.GeoAxes matplotlib.projections.geo.HammerAxes matplotlib.projections.geo.LambertAxes matplotlib.projections.geo.MollweideAxes matplotlib.projections.polar.PolarAxes matplotlib.projections.polar.RadialAxis matplotlib.projections.polar.RadialTick matplotlib.projections.polar.ThetaAxis matplotlib.projections.polar.ThetaTick matplotlib.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.tri.TriContourSet
14+
.. inheritance-diagram:: matplotlib.axes._axes.Axes matplotlib.axes._base._AxesBase matplotlib.axis.Axis matplotlib.axis.Tick matplotlib.axis.XAxis matplotlib.axis.XTick matplotlib.axis.YAxis matplotlib.axis.YTick matplotlib.collections.AsteriskPolygonCollection matplotlib.collections.CircleCollection matplotlib.collections.Collection matplotlib.collections.EllipseCollection matplotlib.collections.EventCollection matplotlib.collections.LineCollection matplotlib.collections.PatchCollection matplotlib.collections.PathCollection matplotlib.collections.PolyCollection matplotlib.collections.QuadMesh matplotlib.collections.RegularPolyCollection matplotlib.collections.StarPolygonCollection matplotlib.collections.TriMesh matplotlib.collections._CollectionWithSizes matplotlib.contour.ClabelText matplotlib.contour.ContourSet matplotlib.contour.QuadContourSet matplotlib.figure.FigureBase matplotlib.figure.Figure matplotlib.figure.SubFigure matplotlib.image.AxesImage matplotlib.image.BboxImage matplotlib.image.FigureImage matplotlib.image.NonUniformImage matplotlib.image.PcolorImage matplotlib.image._ImageBase matplotlib.legend.Legend matplotlib.lines.Line2D matplotlib.offsetbox.AnchoredOffsetbox matplotlib.offsetbox.AnchoredText matplotlib.offsetbox.AnnotationBbox matplotlib.offsetbox.AuxTransformBox matplotlib.offsetbox.DrawingArea matplotlib.offsetbox.HPacker matplotlib.offsetbox.OffsetBox matplotlib.offsetbox.OffsetImage matplotlib.offsetbox.PackerBase matplotlib.offsetbox.PaddedBox matplotlib.offsetbox.TextArea matplotlib.offsetbox.VPacker matplotlib.patches.Annulus matplotlib.patches.Arc matplotlib.patches.Arrow matplotlib.patches.Circle matplotlib.patches.CirclePolygon matplotlib.patches.ConnectionPatch matplotlib.patches.Ellipse matplotlib.patches.FancyArrow matplotlib.patches.FancyArrowPatch matplotlib.patches.FancyBboxPatch matplotlib.patches.Patch matplotlib.patches.PathPatch matplotlib.patches.Polygon matplotlib.patches.Rectangle matplotlib.patches.RegularPolygon matplotlib.patches.Shadow matplotlib.patches.StepPatch matplotlib.patches.Wedge matplotlib.projections.geo.AitoffAxes matplotlib.projections.geo.GeoAxes matplotlib.projections.geo.HammerAxes matplotlib.projections.geo.LambertAxes matplotlib.projections.geo.MollweideAxes matplotlib.projections.polar.PolarAxes matplotlib.projections.polar.RadialAxis matplotlib.projections.polar.RadialTick matplotlib.projections.polar.ThetaAxis matplotlib.projections.polar.ThetaTick matplotlib.quiver.Barbs matplotlib.quiver.Quiver matplotlib.quiver.QuiverKey matplotlib.spines.Spine matplotlib.table.Cell matplotlib.table.Table matplotlib.text.Annotation matplotlib.text.Text matplotlib.tri.TriContourSet
1515
:parts: 1
1616
:private-bases:
1717

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
``collections.PolyCollection.span_where`` and ``collections.BrokenBarHCollection``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
4+
... removed as it was deprecated during 3.7. Use ``fill_between`` instead

doc/users/prev_whats_new/whats_new_1.4.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ Added size related functions to specialized `.Collection`\s
221221
Added the ``get_size`` and ``set_size`` functions to control the size of
222222
elements of specialized collections (
223223
:class:`~matplotlib.collections.AsteriskPolygonCollection`
224-
:class:`~matplotlib.collections.BrokenBarHCollection`
224+
``matplotlib.collections.BrokenBarHCollection``
225225
:class:`~matplotlib.collections.CircleCollection`
226226
:class:`~matplotlib.collections.PathCollection`
227227
:class:`~matplotlib.collections.PolyCollection`

lib/matplotlib/axes/_axes.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ from matplotlib.backend_bases import RendererBase
66
from matplotlib.collections import (
77
Collection,
88
LineCollection,
9-
BrokenBarHCollection,
109
PathCollection,
1110
PolyCollection,
1211
EventCollection,
@@ -282,7 +281,7 @@ class Axes(_AxesBase):
282281
*,
283282
data=...,
284283
**kwargs
285-
) -> BrokenBarHCollection: ...
284+
) -> PolyCollection: ...
286285
def stem(
287286
self,
288287
*args: ArrayLike | str,

lib/matplotlib/collections.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,51 +1253,6 @@ def set_verts_and_codes(self, verts, codes):
12531253
for xy, cds in zip(verts, codes)]
12541254
self.stale = True
12551255

1256-
@classmethod
1257-
@_api.deprecated("3.7", alternative="fill_between")
1258-
def span_where(cls, x, ymin, ymax, where, **kwargs):
1259-
"""
1260-
Return a `.BrokenBarHCollection` that plots horizontal bars from
1261-
over the regions in *x* where *where* is True. The bars range
1262-
on the y-axis from *ymin* to *ymax*
1263-
1264-
*kwargs* are passed on to the collection.
1265-
"""
1266-
xranges = []
1267-
for ind0, ind1 in cbook.contiguous_regions(where):
1268-
xslice = x[ind0:ind1]
1269-
if not len(xslice):
1270-
continue
1271-
xranges.append((xslice[0], xslice[-1] - xslice[0]))
1272-
return BrokenBarHCollection(xranges, [ymin, ymax - ymin], **kwargs)
1273-
1274-
1275-
@_api.deprecated("3.7")
1276-
class BrokenBarHCollection(PolyCollection):
1277-
"""
1278-
A collection of horizontal bars spanning *yrange* with a sequence of
1279-
*xranges*.
1280-
"""
1281-
def __init__(self, xranges, yrange, **kwargs):
1282-
"""
1283-
Parameters
1284-
----------
1285-
xranges : list of (float, float)
1286-
The sequence of (left-edge-position, width) pairs for each bar.
1287-
yrange : (float, float)
1288-
The (lower-edge, height) common to all bars.
1289-
**kwargs
1290-
Forwarded to `.Collection`.
1291-
"""
1292-
ymin, ywidth = yrange
1293-
ymax = ymin + ywidth
1294-
verts = [[(xmin, ymin),
1295-
(xmin, ymax),
1296-
(xmin + xwidth, ymax),
1297-
(xmin + xwidth, ymin),
1298-
(xmin, ymin)] for xmin, xwidth in xranges]
1299-
super().__init__(verts, **kwargs)
1300-
13011256

13021257
class RegularPolyCollection(_CollectionWithSizes):
13031258
"""A collection of n-sided regular polygons."""

lib/matplotlib/collections.pyi

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -106,18 +106,6 @@ class PolyCollection(_CollectionWithSizes):
106106
self, verts: Sequence[ArrayLike | Path], codes: Sequence[int]
107107
) -> None: ...
108108

109-
class BrokenBarHCollection(PolyCollection):
110-
def __init__(
111-
self,
112-
xranges: Iterable[tuple[float, float]],
113-
yrange: tuple[float, float],
114-
**kwargs
115-
) -> None: ...
116-
@classmethod
117-
def span_where(
118-
cls, x: ArrayLike, ymin: float, ymax: float, where: ArrayLike, **kwargs
119-
) -> BrokenBarHCollection: ...
120-
121109
class RegularPolyCollection(_CollectionWithSizes):
122110
def __init__(
123111
self, numsides: int, *, rotation: float = ..., sizes: ArrayLike = ..., **kwargs

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@
9999
from matplotlib.collections import (
100100
Collection,
101101
LineCollection,
102-
BrokenBarHCollection,
103102
PolyCollection,
104103
PathCollection,
105104
EventCollection,
@@ -2873,7 +2872,7 @@ def broken_barh(
28732872
*,
28742873
data=None,
28752874
**kwargs,
2876-
) -> BrokenBarHCollection:
2875+
) -> PolyCollection:
28772876
return gca().broken_barh(
28782877
xranges, yrange, **({"data": data} if data is not None else {}), **kwargs
28792878
)

0 commit comments

Comments
 (0)