From 4a6f09a7fbf4ca99f5ce6f3249c573fccfc40f30 Mon Sep 17 00:00:00 2001 From: James Evans Date: Tue, 11 Aug 2015 08:58:39 -0700 Subject: [PATCH 1/2] JRE - broken_barh and hist were not handling unitized data. --- lib/matplotlib/axes/_axes.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 01c94be87190..342b70f1bed2 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2275,6 +2275,11 @@ def broken_barh(self, xranges, yrange, **kwargs): .. plot:: mpl_examples/pylab_examples/broken_barh.py """ + # process the unit information + self._process_unit_info(xdata=xranges[0], ydata=yrange[0], kwargs=kwargs) + xranges = self.convert_xunits(xranges) + yrange = self.convert_yunits(yrange) + col = mcoll.BrokenBarHCollection(xranges, yrange, **kwargs) self.add_collection(col, autolim=True) self.autoscale_view() @@ -5785,6 +5790,12 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None, if histtype == 'barstacked' and not stacked: stacked = True + # process the unit information + self._process_unit_info(xdata=x, kwargs=kwargs) + x = self.convert_xunits(x) + if bin_range is not None: + bin_range = self.convert_xunits(bin_range) + # Check whether bins or range are given explicitly. binsgiven = (cbook.iterable(bins) or bin_range is not None) From a05a50844f804a9bce6d567a246dbefebd04234a Mon Sep 17 00:00:00 2001 From: James Evans Date: Wed, 12 Aug 2015 10:28:07 -0700 Subject: [PATCH 2/2] Wrapped a line of code as requested. --- lib/matplotlib/axes/_axes.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py index 342b70f1bed2..c2b8dc60fae3 100644 --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -2276,7 +2276,9 @@ def broken_barh(self, xranges, yrange, **kwargs): .. plot:: mpl_examples/pylab_examples/broken_barh.py """ # process the unit information - self._process_unit_info(xdata=xranges[0], ydata=yrange[0], kwargs=kwargs) + self._process_unit_info(xdata=xranges[0], + ydata=yrange[0], + kwargs=kwargs) xranges = self.convert_xunits(xranges) yrange = self.convert_yunits(yrange)