@@ -294,8 +294,9 @@ def validate_maskedarray(v):
294294
295295
296296class validate_nseq_float (object ):
297- def __init__ (self , n = None ):
297+ def __init__ (self , n = None , allow_none = False ):
298298 self .n = n
299+ self .allow_none = allow_none
299300
300301 def __call__ (self , s ):
301302 """return a seq of n floats or raise"""
@@ -309,7 +310,10 @@ def __call__(self, s):
309310 raise ValueError (err_msg .format (n = self .n , num = len (s ), s = s ))
310311
311312 try :
312- return [float (val ) for val in s ]
313+ return [float (val )
314+ if not self .allow_none or val is not None
315+ else val
316+ for val in s ]
313317 except ValueError :
314318 raise ValueError ('Could not convert all entries to floats' )
315319
@@ -697,7 +701,7 @@ def validate_hatch(s):
697701 raise ValueError ("Unknown hatch symbol(s): %s" % list (unknown ))
698702 return s
699703validate_hatchlist = _listify_validator (validate_hatch )
700- validate_dashlist = _listify_validator (validate_nseq_float ())
704+ validate_dashlist = _listify_validator (validate_nseq_float (allow_none = True ))
701705
702706_prop_validators = {
703707 'color' : _listify_validator (validate_color_for_prop_cycle ,
@@ -963,9 +967,10 @@ def _validate_linestyle(ls):
963967 'lines.solid_joinstyle' : ['round' , validate_joinstyle ],
964968 'lines.dash_capstyle' : ['butt' , validate_capstyle ],
965969 'lines.solid_capstyle' : ['projecting' , validate_capstyle ],
966- 'lines.dashed_pattern' : [[3.7 , 1.6 ], validate_nseq_float ()],
967- 'lines.dashdot_pattern' : [[6.4 , 1.6 , 1 , 1.6 ], validate_nseq_float ()],
968- 'lines.dotted_pattern' : [[1 , 1.65 ], validate_nseq_float ()],
970+ 'lines.dashed_pattern' : [[3.7 , 1.6 ], validate_nseq_float (allow_none = True )],
971+ 'lines.dashdot_pattern' : [[6.4 , 1.6 , 1 , 1.6 ],
972+ validate_nseq_float (allow_none = True )],
973+ 'lines.dotted_pattern' : [[1 , 1.65 ], validate_nseq_float (allow_none = True )],
969974 'lines.scale_dashes' : [True , validate_bool ],
970975
971976 # marker props
0 commit comments