Skip to content

Commit 91f9670

Browse files
committed
add filter to cbook.safe_first_element to avoid returning masked values
1 parent 7a2fb4e commit 91f9670

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/cbook/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@ def safe_first_element(obj):
23112311
pass
23122312
raise RuntimeError("matplotlib does not support generators "
23132313
"as input")
2314-
return next(filter(None, iter(obj)))
2314+
return next(filter(lambda e: not np.ma.is_masked(e), iter(obj)))
23152315

23162316

23172317
def sanitize_sequence(data):

0 commit comments

Comments
 (0)