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

Skip to content

Commit 0e3a6ae

Browse files
committed
Merge pull request #4906 from jrevans/issue05
FIX: broken_barh does not properly support units
2 parents 3f758ab + a05a508 commit 0e3a6ae

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,13 @@ def broken_barh(self, xranges, yrange, **kwargs):
22752275
22762276
.. plot:: mpl_examples/pylab_examples/broken_barh.py
22772277
"""
2278+
# process the unit information
2279+
self._process_unit_info(xdata=xranges[0],
2280+
ydata=yrange[0],
2281+
kwargs=kwargs)
2282+
xranges = self.convert_xunits(xranges)
2283+
yrange = self.convert_yunits(yrange)
2284+
22782285
col = mcoll.BrokenBarHCollection(xranges, yrange, **kwargs)
22792286
self.add_collection(col, autolim=True)
22802287
self.autoscale_view()
@@ -5785,6 +5792,12 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
57855792
if histtype == 'barstacked' and not stacked:
57865793
stacked = True
57875794

5795+
# process the unit information
5796+
self._process_unit_info(xdata=x, kwargs=kwargs)
5797+
x = self.convert_xunits(x)
5798+
if bin_range is not None:
5799+
bin_range = self.convert_xunits(bin_range)
5800+
57885801
# Check whether bins or range are given explicitly.
57895802
binsgiven = (cbook.iterable(bins) or bin_range is not None)
57905803

0 commit comments

Comments
 (0)