@@ -1082,6 +1082,30 @@ def test_hist_steplog():
1082
1082
plt .hist (data_big , 100 , histtype = 'stepfilled' , log = True , orientation = 'horizontal' )
1083
1083
1084
1084
1085
+ @image_comparison (baseline_images = ['hist_step_log_bottom' ],
1086
+ remove_text = True , extensions = ['png' ])
1087
+ def test_hist_step_log_bottom ():
1088
+ # check that bottom doesn't get overwritten by the 'minimum' on a
1089
+ # log scale histogram (https://github.com/matplotlib/matplotlib/pull/4608)
1090
+ np .random .seed (0 )
1091
+ data = np .random .standard_normal (2000 )
1092
+ fig = plt .figure ()
1093
+ ax = fig .add_subplot (111 )
1094
+ # normal hist (should clip minimum to 1/base)
1095
+ ax .hist (data , bins = 10 , log = True , histtype = 'stepfilled' ,
1096
+ alpha = 0.5 , color = 'b' )
1097
+ # manual bottom < 1/base (previously buggy, see #4608)
1098
+ ax .hist (data , bins = 10 , log = True , histtype = 'stepfilled' ,
1099
+ alpha = 0.5 , color = 'g' , bottom = 1e-2 )
1100
+ # manual bottom > 1/base
1101
+ ax .hist (data , bins = 10 , log = True , histtype = 'stepfilled' ,
1102
+ alpha = 0.5 , color = 'r' , bottom = 0.5 )
1103
+ # array bottom with some less than 1/base (should clip to 1/base)
1104
+ ax .hist (data , bins = 10 , log = True , histtype = 'stepfilled' ,
1105
+ alpha = 0.5 , color = 'y' , bottom = np .arange (10 ))
1106
+ ax .set_ylim (9e-3 , 1e3 )
1107
+
1108
+
1085
1109
def contour_dat ():
1086
1110
x = np .linspace (- 3 , 5 , 150 )
1087
1111
y = np .linspace (- 3 , 5 , 120 )
0 commit comments