File tree Expand file tree Collapse file tree 4 files changed +40
-6
lines changed Expand file tree Collapse file tree 4 files changed +40
-6
lines changed Original file line number Diff line number Diff line change 1
1
New rcParams
2
2
------------
3
3
4
- The parameters `xtick.top `, `xtick.bottom `, `ytick.left `
5
- and `ytick.right ` were added to control where the ticks
6
- are drawn.
4
+ The parameters ``xtick.top ``, ``xtick.bottom ``, ``ytick.left ``
5
+ and ``ytick.right `` were added to control where the ticks
6
+ are drawn.
7
+
8
+ ``hist.bins `` to control the default number of bins to use in
9
+ `~matplotlib.axes.Axes.hist `. This can be an `int `, a list of floats, or
10
+ ``'auto' `` if numpy >= 1.11 is installed.
Original file line number Diff line number Diff line change @@ -29,6 +29,8 @@ patch.facecolor : b
29
29
patch.edgecolor : k
30
30
patch.antialiased : True # render patches in antialiased (no jaggies)
31
31
32
+ hist.bins : 10
33
+
32
34
### FONT
33
35
#
34
36
# font properties used by text.Text. See
Original file line number Diff line number Diff line change @@ -770,6 +770,23 @@ def validate_cycler(s):
770
770
return cycler_inst
771
771
772
772
773
+ def validate_hist_bins (s ):
774
+ if isinstance (s , six .text_type ) and s == 'auto' :
775
+ return s
776
+ try :
777
+ return int (s )
778
+ except (TypeError , ValueError ):
779
+ pass
780
+
781
+ try :
782
+ return validate_floatlist (s )
783
+ except ValueError :
784
+ pass
785
+
786
+ raise ValueError ("'hist.bins' must be 'auto', an int or " +
787
+ "a sequence of floats" )
788
+
789
+
773
790
# a map from key -> value, converter
774
791
defaultParams = {
775
792
'backend' : ['Agg' , validate_backend ], # agg is certainly
@@ -814,7 +831,7 @@ def validate_cycler(s):
814
831
'patch.antialiased' : [True , validate_bool ], # antialiased (no jaggies)
815
832
816
833
## Histogram properties
817
- 'hist.bins' : [10 , validate_any ],
834
+ 'hist.bins' : [10 , validate_hist_bins ],
818
835
819
836
## Boxplot properties
820
837
'boxplot.notch' : [False , validate_bool ],
Original file line number Diff line number Diff line change 27
27
validate_nseq_int ,
28
28
validate_nseq_float ,
29
29
validate_cycler ,
30
- validate_hatch )
30
+ validate_hatch ,
31
+ validate_hist_bins )
31
32
32
33
33
34
mpl .rc ('text' , usetex = False )
@@ -363,7 +364,17 @@ def test_validators():
363
364
),
364
365
'fail' : (('fish' , ValueError ),
365
366
),
366
- }
367
+ },
368
+ {'validator' : validate_hist_bins ,
369
+ 'success' : (('auto' , 'auto' ),
370
+ ('10' , 10 ),
371
+ ('1, 2, 3' , [1 , 2 , 3 ]),
372
+ ([1 , 2 , 3 ], [1 , 2 , 3 ]),
373
+ (np .arange (15 ), np .arange (15 ))
374
+ ),
375
+ 'fail' : (('aardvark' , ValueError ),
376
+ )
377
+ }
367
378
)
368
379
369
380
for validator_dict in validation_tests :
You can’t perform that action at this time.
0 commit comments