@@ -151,6 +151,51 @@ def test_distplot_more_args(self):
151151 'yaxis' : 'y1' }
152152 self .assertEqual (dp ['data' ][1 ], expected_dp_data_hist_2 )
153153
154+ def test_distplot_binsize_array (self ):
155+ hist1_x = [0.8 , 1.2 , 0.2 , 0.6 , 1.6 , - 0.9 , - 0.07 , 1.95 , 0.9 , - 0.2 ,
156+ - 0.5 , 0.3 , 0.4 , - 0.37 , 0.6 ]
157+ hist2_x = [0.8 , 1.5 , 1.5 , 0.6 , 0.59 , 1.0 , 0.8 , 1.7 , 0.5 , 0.8 , - 0.3 ,
158+ 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+
154199
155200class TestStreamline (TestCase ):
156201
@@ -424,7 +469,7 @@ def test_dendrogram_random_matrix(self):
424469 self .assert_dict_equal (dendro ['layout' ], expected_dendro ['layout' ])
425470
426471 def test_dendrogram_orientation (self ):
427- X = np .random .rand (5 , 5 )
472+ X = np .random .rand (5 , 5 )
428473
429474 dendro_left = tls .FigureFactory .create_dendrogram (
430475 X , orientation = 'left' )
0 commit comments