@@ -149,6 +149,53 @@ def test_distplot_more_args(self):
149
149
'yaxis' : 'y1' }
150
150
self .assertEqual (dp ['data' ][1 ], expected_dp_data_hist_2 )
151
151
152
+ def test_distplot_binsize_array (self ):
153
+ hist1_x = [0.8 , 1.2 , 0.2 , 0.6 , 1.6 ,
154
+ - 0.9 , - 0.07 , 1.95 , 0.9 , - 0.2 ,
155
+ - 0.5 , 0.3 , 0.4 , - 0.37 , 0.6 ]
156
+ hist2_x = [0.8 , 1.5 , 1.5 , 0.6 , 0.59 ,
157
+ 1.0 , 0.8 , 1.7 , 0.5 , 0.8 ,
158
+ - 0.3 , 1.2 , 0.56 , 0.3 , 2.2 ]
159
+
160
+ hist_data = [hist1_x ] + [hist2_x ]
161
+ group_labels = ['2012' , '2013' ]
162
+
163
+ dp = tls .FigureFactory .create_distplot (hist_data , group_labels ,
164
+ show_rug = False ,
165
+ bin_size = [.2 , .2 ])
166
+
167
+ expected_dp_data_hist_1 = {'autobinx' : False ,
168
+ 'histnorm' : 'probability' ,
169
+ 'legendgroup' : '2012' ,
170
+ 'marker' : {'color' : 'rgb(31, 119, 180)' },
171
+ 'name' : '2012' ,
172
+ 'opacity' : 0.7 ,
173
+ 'type' : 'histogram' ,
174
+ 'x' : [0.8 , 1.2 , 0.2 , 0.6 , 1.6 , - 0.9 , - 0.07 ,
175
+ 1.95 , 0.9 , - 0.2 , - 0.5 , 0.3 , 0.4 ,
176
+ - 0.37 , 0.6 ],
177
+ 'xaxis' : 'x1' ,
178
+ 'xbins' : {'end' : 1.95 , 'size' : 0.2 ,
179
+ 'start' : - 0.9 },
180
+ 'yaxis' : 'y1' }
181
+ self .assertEqual (dp ['data' ][0 ], expected_dp_data_hist_1 )
182
+
183
+ expected_dp_data_hist_2 = {'autobinx' : False ,
184
+ 'histnorm' : 'probability' ,
185
+ 'legendgroup' : '2013' ,
186
+ 'marker' : {'color' : 'rgb(255, 127, 14)' },
187
+ 'name' : '2013' ,
188
+ 'opacity' : 0.7 ,
189
+ 'type' : 'histogram' ,
190
+ 'x' : [0.8 , 1.5 , 1.5 , 0.6 , 0.59 , 1.0 , 0.8 ,
191
+ 1.7 , 0.5 , 0.8 , - 0.3 , 1.2 , 0.56 , 0.3 ,
192
+ 2.2 ],
193
+ 'xaxis' : 'x1' ,
194
+ 'xbins' : {'end' : 2.2 , 'size' : 0.2 ,
195
+ 'start' : - 0.3 },
196
+ 'yaxis' : 'y1' }
197
+ self .assertEqual (dp ['data' ][1 ], expected_dp_data_hist_2 )
198
+
152
199
153
200
class TestStreamline (TestCase ):
154
201
@@ -422,7 +469,7 @@ def test_dendrogram_random_matrix(self):
422
469
self .assert_dict_equal (dendro ['layout' ], expected_dendro ['layout' ])
423
470
424
471
def test_dendrogram_orientation (self ):
425
- X = np .random .rand (5 , 5 )
472
+ X = np .random .rand (5 , 5 )
426
473
427
474
dendro_left = tls .FigureFactory .create_dendrogram (
428
475
X , orientation = 'left' )
0 commit comments