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

Skip to content

Commit cc32546

Browse files
committed
Add support for data with units to Axes.fill_between().
svn path=/trunk/matplotlib/; revision=6497
1 parent c9acf10 commit cc32546

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/matplotlib/axes.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5578,7 +5578,15 @@ def fill_between(self, x, y1, y2=0, where=None, **kwargs):
55785578
%(PolyCollection)s
55795579
55805580
"""
5581-
x = np.asarray(x)
5581+
# Handle united data, such as dates
5582+
self._process_unit_info(xdata=x, ydata=y1, kwargs=kwargs)
5583+
self._process_unit_info(ydata=y2)
5584+
5585+
# Convert the arrays so we can work with them
5586+
x = np.asarray(self.convert_xunits(x))
5587+
y1 = np.asarray(self.convert_yunits(y1))
5588+
y2 = np.asarray(self.convert_yunits(y2))
5589+
55825590
if not cbook.iterable(y1):
55835591
y1 = np.ones_like(x)*y1
55845592

@@ -5588,8 +5596,6 @@ def fill_between(self, x, y1, y2=0, where=None, **kwargs):
55885596
if where is None:
55895597
where = np.ones(len(x), np.bool)
55905598

5591-
y1 = np.asarray(y1)
5592-
y2 = np.asarray(y2)
55935599
where = np.asarray(where)
55945600
assert( (len(x)==len(y1)) and (len(x)==len(y2)) and len(x)==len(where))
55955601

0 commit comments

Comments
 (0)