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

Skip to content

Commit 4a6f09a

Browse files
author
James Evans
committed
JRE - broken_barh and hist were not handling unitized data.
1 parent 7900ee4 commit 4a6f09a

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2275,6 +2275,11 @@ 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], ydata=yrange[0], kwargs=kwargs)
2280+
xranges = self.convert_xunits(xranges)
2281+
yrange = self.convert_yunits(yrange)
2282+
22782283
col = mcoll.BrokenBarHCollection(xranges, yrange, **kwargs)
22792284
self.add_collection(col, autolim=True)
22802285
self.autoscale_view()
@@ -5785,6 +5790,12 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
57855790
if histtype == 'barstacked' and not stacked:
57865791
stacked = True
57875792

5793+
# process the unit information
5794+
self._process_unit_info(xdata=x, kwargs=kwargs)
5795+
x = self.convert_xunits(x)
5796+
if bin_range is not None:
5797+
bin_range = self.convert_xunits(bin_range)
5798+
57885799
# Check whether bins or range are given explicitly.
57895800
binsgiven = (cbook.iterable(bins) or bin_range is not None)
57905801

0 commit comments

Comments
 (0)