@@ -139,6 +139,16 @@ def validate_int(s):
139139 except ValueError :
140140 raise ValueError ('Could not convert "%s" to int' % s )
141141
142+ def validate_int_or_None (s ):
143+ """if not None, tries to validate as an int"""
144+ if s == 'None' :
145+ s = None
146+ if s is None :
147+ return None
148+ try :
149+ return int (s )
150+ except ValueError :
151+ raise ValueError ('Could not convert "%s" to int' % s )
142152
143153def validate_fonttype (s ):
144154 """
@@ -352,6 +362,22 @@ def validate_font_properties(s):
352362 'verbose' ,
353363 ['silent' , 'helpful' , 'debug' , 'debug-annoying' ])
354364
365+ def validate_whiskers (s ):
366+ if s == 'range' :
367+ return 'range'
368+ else :
369+ try :
370+ v = validate_nseq_float (2 )(s )
371+ return v
372+ except :
373+ try :
374+ v = float (s )
375+ return v
376+ except :
377+ err_str = ("Not a valid whisker value ['range',"
378+ "float, (float, float)]" )
379+ raise ValueError (err_str )
380+
355381
356382def deprecate_savefig_extension (value ):
357383 warnings .warn ("savefig.extension is deprecated. Use savefig.format "
@@ -471,7 +497,7 @@ def validate_hinting(s):
471497validate_movie_frame_fmt = ValidateInStrings ('animation.frame_format' ,
472498 ['png' , 'jpeg' , 'tiff' , 'raw' , 'rgba' ])
473499
474- validate_axis_locator = ValidateInStrings ('major' , ['minor' ,'both' ,'major' ])
500+ validate_axis_locator = ValidateInStrings ('major' , ['minor' , 'both' , 'major' ])
475501
476502def validate_bbox (s ):
477503 if isinstance (s , six .string_types ):
@@ -530,6 +556,7 @@ def __call__(self, s):
530556 (self .vmax , s ))
531557 return s
532558
559+ validate_grid_axis = ValidateInStrings ('axes.grid.axis' , ['x' , 'y' , 'both' ])
533560
534561# a map from key -> value, converter
535562defaultParams = {
@@ -574,6 +601,45 @@ def __call__(self, s):
574601 'patch.facecolor' : ['b' , validate_color ], # blue
575602 'patch.antialiased' : [True , validate_bool ], # antialised (no jaggies)
576603
604+ ## Boxplot properties
605+ 'boxplot.notch' : [False , validate_bool ],
606+ 'boxplot.vertical' : [True , validate_bool ],
607+ 'boxplot.whiskers' : [1.5 , validate_whiskers ],
608+ 'boxplot.bootstrap' : [None , validate_int_or_None ],
609+ 'boxplot.patchartist' : [False , validate_bool ],
610+ 'boxplot.showmeans' : [False , validate_bool ],
611+ 'boxplot.showcaps' : [True , validate_bool ],
612+ 'boxplot.showbox' : [True , validate_bool ],
613+ 'boxplot.showfliers' : [True , validate_bool ],
614+ 'boxplot.meanline' : [False , validate_bool ],
615+
616+ 'boxplot.flierprops.color' : ['b' , validate_color ],
617+ 'boxplot.flierprops.marker' : ['+' , six .text_type ],
618+ 'boxplot.flierprops.markerfacecolor' : ['b' , validate_color ],
619+ 'boxplot.flierprops.markeredgecolor' : ['k' , validate_color ],
620+ 'boxplot.flierprops.markersize' : [6 , validate_float ],
621+ 'boxplot.flierprops.linestyle' : ['-' , six .text_type ],
622+ 'boxplot.flierprops.linewidth' : [1.0 , validate_float ],
623+
624+ 'boxplot.boxprops.color' : ['b' , validate_color ],
625+ 'boxplot.boxprops.linewidth' : [1.0 , validate_float ],
626+ 'boxplot.boxprops.linestyle' : ['-' , six .text_type ],
627+
628+ 'boxplot.whiskerprops.color' : ['b' , validate_color ],
629+ 'boxplot.whiskerprops.linewidth' : [1.0 , validate_float ],
630+ 'boxplot.whiskerprops.linestyle' : ['--' , six .text_type ],
631+
632+ 'boxplot.capprops.color' : ['k' , validate_color ],
633+ 'boxplot.capprops.linewidth' : [1.0 , validate_float ],
634+ 'boxplot.capprops.linestyle' : ['-' , six .text_type ],
635+
636+ 'boxplot.medianprops.color' : ['r' , validate_color ],
637+ 'boxplot.medianprops.linewidth' : [1.0 , validate_float ],
638+ 'boxplot.medianprops.linestyle' : ['-' , six .text_type ],
639+
640+ 'boxplot.meanprops.color' : ['r' , validate_color ],
641+ 'boxplot.meanprops.linewidth' : [1.0 , validate_float ],
642+ 'boxplot.meanprops.linestyle' : ['-' , six .text_type ],
577643
578644 ## font props
579645 'font.family' : [['sans-serif' ], validate_stringlist ], # used by text object
@@ -648,6 +714,12 @@ def __call__(self, s):
648714 'axes.facecolor' : ['w' , validate_color ], # background color; white
649715 'axes.edgecolor' : ['k' , validate_color ], # edge color; black
650716 'axes.linewidth' : [1.0 , validate_float ], # edge linewidth
717+
718+ 'axes.spines.left' : [True , validate_bool ], # Set visibility of axes
719+ 'axes.spines.right' : [True , validate_bool ], # 'spines', the lines
720+ 'axes.spines.bottom' : [True , validate_bool ], # around the chart
721+ 'axes.spines.top' : [True , validate_bool ], # denoting data boundary
722+
651723 'axes.titlesize' : ['large' , validate_fontsize ], # fontsize of the
652724 # axes title
653725 'axes.titleweight' : ['normal' , six .text_type ], # font weight of axes title
@@ -656,6 +728,8 @@ def __call__(self, s):
656728 # default draw on 'major'
657729 # 'minor' or 'both' kind of
658730 # axis locator
731+ 'axes.grid.axis' : ['both' , validate_grid_axis ], # grid type.
732+ # Can be 'x', 'y', 'both'
659733 'axes.labelsize' : ['medium' , validate_fontsize ], # fontsize of the
660734 # x any y labels
661735 'axes.labelpad' : [5.0 , validate_float ], # space between label and axis
0 commit comments