@@ -552,12 +552,12 @@ def validate_sketch(s):
552
552
raise ValueError ("Expected a (scale, length, randomness) triplet" )
553
553
554
554
555
- def _validate_greaterequal0_lessthan1 (s ):
555
+ def _validate_greaterthan_minushalf (s ):
556
556
s = validate_float (s )
557
- if 0 <= s < 1 :
557
+ if s > - 0.5 :
558
558
return s
559
559
else :
560
- raise RuntimeError (f'Value must be >=0 and <1 ; got { s } ' )
560
+ raise RuntimeError (f'Value must be >-0.5 ; got { s } ' )
561
561
562
562
563
563
def _validate_greaterequal0_lessequal1 (s ):
@@ -568,12 +568,6 @@ def _validate_greaterequal0_lessequal1(s):
568
568
raise RuntimeError (f'Value must be >=0 and <=1; got { s } ' )
569
569
570
570
571
- _range_validators = { # Slightly nicer (internal) API.
572
- "0 <= x < 1" : _validate_greaterequal0_lessthan1 ,
573
- "0 <= x <= 1" : _validate_greaterequal0_lessequal1 ,
574
- }
575
-
576
-
577
571
def validate_hatch (s ):
578
572
r"""
579
573
Validate a hatch pattern.
@@ -1012,9 +1006,9 @@ def _convert_validator_spec(key, conv):
1012
1006
# If "data", axes limits are set close to the data.
1013
1007
# If "round_numbers" axes limits are set to the nearest round numbers.
1014
1008
"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
1018
1012
1019
1013
"polaraxes.grid" : validate_bool , # display polar grid or not
1020
1014
"axes3d.grid" : validate_bool , # display 3d grid
@@ -1149,21 +1143,21 @@ def _convert_validator_spec(key, conv):
1149
1143
"figure.max_open_warning" : validate_int ,
1150
1144
"figure.raise_window" : validate_bool ,
1151
1145
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 ,
1158
1152
1159
1153
"figure.constrained_layout.use" : validate_bool , # run constrained_layout?
1160
1154
# wspace and hspace are fraction of adjacent subplots to use for space.
1161
1155
# 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 ,
1164
1158
# 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 ,
1167
1161
1168
1162
## Saving figure's properties
1169
1163
'savefig.dpi' : validate_dpi ,
@@ -1207,7 +1201,7 @@ def _convert_validator_spec(key, conv):
1207
1201
"docstring.hardcopy" : validate_bool ,
1208
1202
1209
1203
"path.simplify" : validate_bool ,
1210
- "path.simplify_threshold" : _range_validators [ "0 <= x <= 1" ] ,
1204
+ "path.simplify_threshold" : _validate_greaterequal0_lessequal1 ,
1211
1205
"path.snap" : validate_bool ,
1212
1206
"path.sketch" : validate_sketch ,
1213
1207
"path.effects" : validate_anylist ,
0 commit comments