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

Skip to content

Commit e103fc9

Browse files
committed
axes: quick fix to make fill_between_demo work again
svn path=/trunk/matplotlib/; revision=8371
1 parent 14f2038 commit e103fc9

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

lib/matplotlib/axes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6278,13 +6278,14 @@ def fill_between(self, x, y1, y2=0, where=None, interpolate=False,
62786278

62796279
if interpolate:
62806280
def get_interp_point(ind):
6281-
x_values = x[ind-1:ind+1]
6282-
diff_values = y1[ind-1:ind+1] - y2[ind-1:ind+1]
6283-
y1_values = y1[ind-1:ind+1]
6281+
im1 = max(ind-1, 0)
6282+
x_values = x[im1:ind+1]
6283+
diff_values = y1[im1:ind+1] - y2[im1:ind+1]
6284+
y1_values = y1[im1:ind+1]
62846285

62856286
if len(diff_values) == 2:
62866287
if np.ma.is_masked(diff_values[1]):
6287-
return x[ind-1], y1[ind-1]
6288+
return x[im1], y1[im1]
62886289
elif np.ma.is_masked(diff_values[0]):
62896290
return x[ind], y1[ind]
62906291

lib/matplotlib/colors.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -382,10 +382,17 @@ def to_rgba_array(self, c, alpha=None):
382382
if (c.ravel() > 1).any() or (c.ravel() < 0).any():
383383
raise ValueError(
384384
"number in rgba sequence is outside 0-1 range")
385-
# looks like rgba already, nothing to be done; do
386-
# we want to apply alpha here if
387-
# (c[:,3]==1).all() ?
388-
return np.asarray(c, np.float)
385+
result = np.asarray(c, np.float)
386+
if alpha is not None:
387+
if alpha > 1 or alpha < 0:
388+
raise ValueError("alpha must be in 0-1 range")
389+
result[:,3] = alpha
390+
return result
391+
# This alpha operation above is new, and depends
392+
# on higher levels to refrain from setting alpha
393+
# to values other than None unless there is
394+
# intent to override any existing alpha values.
395+
389396
# It must be some other sequence of color specs.
390397
result = np.zeros((nc, 4), dtype=np.float)
391398
for i, cc in enumerate(c):

lib/matplotlib/finance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def parse_yahoo_historical(fh, asobject=False, adjusted=True):
4242
4343
where d is a floating poing representation of date, as returned by date2num
4444
45-
if adjust=True, use adjusted prices
45+
if adjusted=True, use adjusted prices
4646
"""
4747
results = []
4848

0 commit comments

Comments
 (0)