File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -153,3 +153,14 @@ def test_jpl_barh_units():
153153def test_empty_arrays ():
154154 # Check that plotting an empty array with a dtype works
155155 plt .scatter (np .array ([], dtype = 'datetime64[ns]' ), np .array ([]))
156+
157+
158+ def test_scatter_element0_masked ():
159+
160+ times = np .arange ('2005-02' , '2005-03' , dtype = 'datetime64[D]' )
161+
162+ y = np .arange (len (times ))
163+ y [0 ] = np .nan
164+ fig , ax = plt .subplots ()
165+ ax .scatter (times , y )
166+ fig .canvas .draw ()
Original file line number Diff line number Diff line change @@ -64,6 +64,8 @@ def _is_natively_supported(x):
6464 if np .iterable (x ):
6565 # Assume lists are homogeneous as other functions in unit system.
6666 for thisx in x :
67+ if thisx is ma .masked :
68+ continue
6769 return isinstance (thisx , Number ) and not isinstance (thisx , Decimal )
6870 else :
6971 return isinstance (x , Number ) and not isinstance (x , Decimal )
@@ -144,6 +146,8 @@ def is_numlike(x):
144146 """
145147 if np .iterable (x ):
146148 for thisx in x :
149+ if thisx is ma .masked :
150+ continue
147151 return isinstance (thisx , Number )
148152 else :
149153 return isinstance (x , Number )
You can’t perform that action at this time.
0 commit comments