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

Skip to content

Commit 8350feb

Browse files
committed
BUG: Mask NaNs in color arrays passed to streamplot
Bug report and fix provided by Jon Ramsey.
1 parent 8b13952 commit 8350feb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/matplotlib/streamplot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
8282
if use_multicolor_lines:
8383
assert color.shape == grid.shape
8484
line_colors = []
85+
if np.any(np.isnan(color)):
86+
color = np.ma.array(color, mask=np.isnan(color))
8587
else:
8688
line_kw['color'] = color
8789
arrow_kw['color'] = color

0 commit comments

Comments
 (0)