Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions lib/matplotlib/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1155,26 +1155,22 @@ def __init__(self, xranges, yrange, **kwargs):
(xmin, ymin)] for xmin, xwidth in xranges]
PolyCollection.__init__(self, verts, **kwargs)

@staticmethod
def span_where(x, ymin, ymax, where, **kwargs):
@classmethod
def span_where(cls, x, ymin, ymax, where, **kwargs):
"""
Create a BrokenBarHCollection to plot horizontal bars from
Return a `BrokenBarHCollection` that plots horizontal bars from
over the regions in *x* where *where* is True. The bars range
on the y-axis from *ymin* to *ymax*

A :class:`BrokenBarHCollection` is returned. *kwargs* are
passed on to the collection.
*kwargs* are passed on to the collection.
"""
xranges = []
for ind0, ind1 in cbook.contiguous_regions(where):
xslice = x[ind0:ind1]
if not len(xslice):
continue
xranges.append((xslice[0], xslice[-1] - xslice[0]))

collection = BrokenBarHCollection(
xranges, [ymin, ymax - ymin], **kwargs)
return collection
return cls(xranges, [ymin, ymax - ymin], **kwargs)


class RegularPolyCollection(_CollectionWithSizes):
Expand Down