|
2 | 2 | unicode_literals)
|
3 | 3 |
|
4 | 4 | import six
|
5 |
| -from six.moves import reduce, xrange, zip, zip_longest |
| 5 | +from six.moves import xrange, zip, zip_longest |
6 | 6 |
|
7 | 7 | from collections import Sized
|
| 8 | +import functools |
8 | 9 | import itertools
|
9 | 10 | import math
|
10 | 11 | import warnings
|
@@ -4714,22 +4715,12 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
|
4714 | 4715 | raise ValueError('Input passed into argument "%r"' % name +
|
4715 | 4716 | 'is not 1-dimensional.')
|
4716 | 4717 |
|
4717 |
| - if y1.ndim == 0: |
4718 |
| - y1 = np.ones_like(x) * y1 |
4719 |
| - if y2.ndim == 0: |
4720 |
| - y2 = np.ones_like(x) * y2 |
4721 |
| - |
4722 | 4718 | if where is None:
|
4723 |
| - where = np.ones(len(x), np.bool) |
4724 |
| - else: |
4725 |
| - where = np.asarray(where, np.bool) |
4726 |
| - |
4727 |
| - if not (x.shape == y1.shape == y2.shape == where.shape): |
4728 |
| - raise ValueError("Argument dimensions are incompatible") |
| 4719 | + where = True |
| 4720 | + where = where & ~functools.reduce(np.logical_or, |
| 4721 | + map(np.ma.getmask, [x, y1, y2])) |
4729 | 4722 |
|
4730 |
| - mask = reduce(ma.mask_or, [ma.getmask(a) for a in (x, y1, y2)]) |
4731 |
| - if mask is not ma.nomask: |
4732 |
| - where &= ~mask |
| 4723 | + x, y1, y2 = np.broadcast_arrays(np.atleast_1d(x), y1, y2) |
4733 | 4724 |
|
4734 | 4725 | polys = []
|
4735 | 4726 | for ind0, ind1 in mlab.contiguous_regions(where):
|
@@ -4875,22 +4866,12 @@ def fill_betweenx(self, y, x1, x2=0, where=None,
|
4875 | 4866 | raise ValueError('Input passed into argument "%r"' % name +
|
4876 | 4867 | 'is not 1-dimensional.')
|
4877 | 4868 |
|
4878 |
| - if x1.ndim == 0: |
4879 |
| - x1 = np.ones_like(y) * x1 |
4880 |
| - if x2.ndim == 0: |
4881 |
| - x2 = np.ones_like(y) * x2 |
4882 |
| - |
4883 | 4869 | if where is None:
|
4884 |
| - where = np.ones(len(y), np.bool) |
4885 |
| - else: |
4886 |
| - where = np.asarray(where, np.bool) |
4887 |
| - |
4888 |
| - if not (y.shape == x1.shape == x2.shape == where.shape): |
4889 |
| - raise ValueError("Argument dimensions are incompatible") |
| 4870 | + where = True |
| 4871 | + where = where & ~functools.reduce(np.logical_or, |
| 4872 | + map(np.ma.getmask, [y, x1, x2])) |
4890 | 4873 |
|
4891 |
| - mask = reduce(ma.mask_or, [ma.getmask(a) for a in (y, x1, x2)]) |
4892 |
| - if mask is not ma.nomask: |
4893 |
| - where &= ~mask |
| 4874 | + y, x1, x2 = np.broadcast_arrays(np.atleast_1d(y), x1, x2) |
4894 | 4875 |
|
4895 | 4876 | polys = []
|
4896 | 4877 | for ind0, ind1 in mlab.contiguous_regions(where):
|
|
0 commit comments