Skip to content

Commit 295f9fa

Browse files
committed
Merge pull request matplotlib#1514 from tonysyu/streamplot-nan-colors
Fix streamplot when color argument has NaNs
2 parents 21f248e + fc43136 commit 295f9fa

12 files changed

+19254
-0
lines changed

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1105,6 +1105,7 @@ def tk_window_focus():
11051105
'matplotlib.tests.test_scale',
11061106
'matplotlib.tests.test_simplification',
11071107
'matplotlib.tests.test_spines',
1108+
'matplotlib.tests.test_streamplot',
11081109
'matplotlib.tests.test_subplots',
11091110
'matplotlib.tests.test_text',
11101111
'matplotlib.tests.test_ticker',

lib/matplotlib/streamplot.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def streamplot(axes, x, y, u, v, density=1, linewidth=None, color=None,
8585
if use_multicolor_lines:
8686
assert color.shape == grid.shape
8787
line_colors = []
88+
if np.any(np.isnan(color)):
89+
color = np.ma.array(color, mask=np.isnan(color))
8890
else:
8991
line_kw['color'] = color
9092
arrow_kw['color'] = color
86.2 KB
Loading

0 commit comments

Comments
 (0)