Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 163aac0

Browse files
authored
Merge pull request #15976 from anntzer/span_where
Cleanup span_where.
2 parents 47375a0 + fb3ea5e commit 163aac0

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/matplotlib/collections.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,26 +1155,22 @@ def __init__(self, xranges, yrange, **kwargs):
11551155
(xmin, ymin)] for xmin, xwidth in xranges]
11561156
PolyCollection.__init__(self, verts, **kwargs)
11571157

1158-
@staticmethod
1159-
def span_where(x, ymin, ymax, where, **kwargs):
1158+
@classmethod
1159+
def span_where(cls, x, ymin, ymax, where, **kwargs):
11601160
"""
1161-
Create a BrokenBarHCollection to plot horizontal bars from
1161+
Return a `BrokenBarHCollection` that plots horizontal bars from
11621162
over the regions in *x* where *where* is True. The bars range
11631163
on the y-axis from *ymin* to *ymax*
11641164
1165-
A :class:`BrokenBarHCollection` is returned. *kwargs* are
1166-
passed on to the collection.
1165+
*kwargs* are passed on to the collection.
11671166
"""
11681167
xranges = []
11691168
for ind0, ind1 in cbook.contiguous_regions(where):
11701169
xslice = x[ind0:ind1]
11711170
if not len(xslice):
11721171
continue
11731172
xranges.append((xslice[0], xslice[-1] - xslice[0]))
1174-
1175-
collection = BrokenBarHCollection(
1176-
xranges, [ymin, ymax - ymin], **kwargs)
1177-
return collection
1173+
return cls(xranges, [ymin, ymax - ymin], **kwargs)
11781174

11791175

11801176
class RegularPolyCollection(_CollectionWithSizes):

0 commit comments

Comments
 (0)