@@ -298,8 +298,9 @@ def validate_maskedarray(v):
298298
299299
300300class validate_nseq_float (object ):
301- def __init__ (self , n = None ):
301+ def __init__ (self , n = None , allow_none = False ):
302302 self .n = n
303+ self .allow_none = allow_none
303304
304305 def __call__ (self , s ):
305306 """return a seq of n floats or raise"""
@@ -313,7 +314,10 @@ def __call__(self, s):
313314 raise ValueError (err_msg .format (n = self .n , num = len (s ), s = s ))
314315
315316 try :
316- return [float (val ) for val in s ]
317+ return [float (val )
318+ if not self .allow_none or val is not None
319+ else val
320+ for val in s ]
317321 except ValueError :
318322 raise ValueError ('Could not convert all entries to floats' )
319323
@@ -695,7 +699,7 @@ def validate_hatch(s):
695699 raise ValueError ("Unknown hatch symbol(s): %s" % list (unknown ))
696700 return s
697701validate_hatchlist = _listify_validator (validate_hatch )
698- validate_dashlist = _listify_validator (validate_nseq_float ())
702+ validate_dashlist = _listify_validator (validate_nseq_float (allow_none = True ))
699703
700704_prop_validators = {
701705 'color' : _listify_validator (validate_color_for_prop_cycle ,
@@ -928,9 +932,10 @@ def validate_animation_writer_path(p):
928932 'lines.solid_joinstyle' : ['round' , validate_joinstyle ],
929933 'lines.dash_capstyle' : ['butt' , validate_capstyle ],
930934 'lines.solid_capstyle' : ['projecting' , validate_capstyle ],
931- 'lines.dashed_pattern' : [[3.7 , 1.6 ], validate_nseq_float ()],
932- 'lines.dashdot_pattern' : [[6.4 , 1.6 , 1 , 1.6 ], validate_nseq_float ()],
933- 'lines.dotted_pattern' : [[1 , 1.65 ], validate_nseq_float ()],
935+ 'lines.dashed_pattern' : [[3.7 , 1.6 ], validate_nseq_float (allow_none = True )],
936+ 'lines.dashdot_pattern' : [[6.4 , 1.6 , 1 , 1.6 ],
937+ validate_nseq_float (allow_none = True )],
938+ 'lines.dotted_pattern' : [[1 , 1.65 ], validate_nseq_float (allow_none = True )],
934939 'lines.scale_dashes' : [True , validate_bool ],
935940
936941 # marker props
0 commit comments