@@ -552,12 +552,12 @@ def validate_sketch(s):
552552 raise ValueError ("Expected a (scale, length, randomness) triplet" )
553553
554554
555- def _validate_greaterequal0_lessthan1 (s ):
555+ def _validate_greaterthan_minushalf (s ):
556556 s = validate_float (s )
557- if 0 <= s < 1 :
557+ if s > - 0.5 :
558558 return s
559559 else :
560- raise RuntimeError (f'Value must be >=0 and <1 ; got { s } ' )
560+ raise RuntimeError (f'Value must be >-0.5 ; got { s } ' )
561561
562562
563563def _validate_greaterequal0_lessequal1 (s ):
@@ -568,12 +568,6 @@ def _validate_greaterequal0_lessequal1(s):
568568 raise RuntimeError (f'Value must be >=0 and <=1; got { s } ' )
569569
570570
571- _range_validators = { # Slightly nicer (internal) API.
572- "0 <= x < 1" : _validate_greaterequal0_lessthan1 ,
573- "0 <= x <= 1" : _validate_greaterequal0_lessequal1 ,
574- }
575-
576-
577571def validate_hatch (s ):
578572 r"""
579573 Validate a hatch pattern.
@@ -1012,9 +1006,9 @@ def _convert_validator_spec(key, conv):
10121006 # If "data", axes limits are set close to the data.
10131007 # If "round_numbers" axes limits are set to the nearest round numbers.
10141008 "axes.autolimit_mode" : ["data" , "round_numbers" ],
1015- "axes.xmargin" : _range_validators [ "0 <= x <= 1" ] , # margin added to xaxis
1016- "axes.ymargin" : _range_validators [ "0 <= x <= 1" ] , # margin added to yaxis
1017- ' axes.zmargin' : _range_validators [ "0 <= x <= 1" ] , # margin added to zaxis
1009+ "axes.xmargin" : _validate_greaterthan_minushalf , # margin added to xaxis
1010+ "axes.ymargin" : _validate_greaterthan_minushalf , # margin added to yaxis
1011+ " axes.zmargin" : _validate_greaterthan_minushalf , # margin added to zaxis
10181012
10191013 "polaraxes.grid" : validate_bool , # display polar grid or not
10201014 "axes3d.grid" : validate_bool , # display 3d grid
@@ -1149,21 +1143,21 @@ def _convert_validator_spec(key, conv):
11491143 "figure.max_open_warning" : validate_int ,
11501144 "figure.raise_window" : validate_bool ,
11511145
1152- "figure.subplot.left" : _range_validators [ "0 <= x <= 1" ] ,
1153- "figure.subplot.right" : _range_validators [ "0 <= x <= 1" ] ,
1154- "figure.subplot.bottom" : _range_validators [ "0 <= x <= 1" ] ,
1155- "figure.subplot.top" : _range_validators [ "0 <= x <= 1" ] ,
1156- "figure.subplot.wspace" : _range_validators [ "0 <= x < 1" ] ,
1157- "figure.subplot.hspace" : _range_validators [ "0 <= x < 1" ] ,
1146+ "figure.subplot.left" : validate_float ,
1147+ "figure.subplot.right" : validate_float ,
1148+ "figure.subplot.bottom" : validate_float ,
1149+ "figure.subplot.top" : validate_float ,
1150+ "figure.subplot.wspace" : validate_float ,
1151+ "figure.subplot.hspace" : validate_float ,
11581152
11591153 "figure.constrained_layout.use" : validate_bool , # run constrained_layout?
11601154 # wspace and hspace are fraction of adjacent subplots to use for space.
11611155 # Much smaller than above because we don't need room for the text.
1162- "figure.constrained_layout.hspace" : _range_validators [ "0 <= x < 1" ] ,
1163- "figure.constrained_layout.wspace" : _range_validators [ "0 <= x < 1" ] ,
1156+ "figure.constrained_layout.hspace" : validate_float ,
1157+ "figure.constrained_layout.wspace" : validate_float ,
11641158 # buffer around the axes, in inches.
1165- ' figure.constrained_layout.h_pad' : validate_float ,
1166- ' figure.constrained_layout.w_pad' : validate_float ,
1159+ " figure.constrained_layout.h_pad" : validate_float ,
1160+ " figure.constrained_layout.w_pad" : validate_float ,
11671161
11681162 ## Saving figure's properties
11691163 'savefig.dpi' : validate_dpi ,
@@ -1207,7 +1201,7 @@ def _convert_validator_spec(key, conv):
12071201 "docstring.hardcopy" : validate_bool ,
12081202
12091203 "path.simplify" : validate_bool ,
1210- "path.simplify_threshold" : _range_validators [ "0 <= x <= 1" ] ,
1204+ "path.simplify_threshold" : _validate_greaterequal0_lessequal1 ,
12111205 "path.snap" : validate_bool ,
12121206 "path.sketch" : validate_sketch ,
12131207 "path.effects" : validate_anylist ,
0 commit comments