@@ -194,17 +194,19 @@ def test_dendrogram_random_matrix(self):
194
194
def test_dendrogram_orientation (self ):
195
195
X = np .random .rand (5 , 5 )
196
196
197
- dendro_left = tls .FigureFactory .create_dendrogram (X , orientation = 'left' )
198
-
197
+ dendro_left = tls .FigureFactory .create_dendrogram (
198
+ X , orientation = 'left' )
199
199
self .assertEqual (len (dendro_left ['layout' ]['yaxis' ]['ticktext' ]), 5 )
200
200
tickvals_left = np .array (dendro_left ['layout' ]['yaxis' ]['tickvals' ])
201
201
self .assertTrue ((tickvals_left <= 0 ).all ())
202
202
203
- dendro_right = tls .FigureFactory .create_dendrogram (X , orientation = 'right' )
203
+ dendro_right = tls .FigureFactory .create_dendrogram (
204
+ X , orientation = 'right' )
204
205
tickvals_right = np .array (dendro_right ['layout' ]['yaxis' ]['tickvals' ])
205
206
self .assertTrue ((tickvals_right >= 0 ).all ())
206
207
207
- dendro_bottom = tls .FigureFactory .create_dendrogram (X , orientation = 'bottom' )
208
+ dendro_bottom = tls .FigureFactory .create_dendrogram (
209
+ X , orientation = 'bottom' )
208
210
self .assertEqual (len (dendro_bottom ['layout' ]['xaxis' ]['ticktext' ]), 5 )
209
211
tickvals_bottom = np .array (dendro_bottom ['layout' ]['xaxis' ]['tickvals' ])
210
212
self .assertTrue ((tickvals_bottom >= 0 ).all ())
@@ -213,4 +215,25 @@ def test_dendrogram_orientation(self):
213
215
tickvals_top = np .array (dendro_top ['layout' ]['xaxis' ]['tickvals' ])
214
216
self .assertTrue ((tickvals_top <= 0 ).all ())
215
217
216
-
218
+ def test_dendrogram_orientation (self ):
219
+ X = np .array ([[1 , 2 , 3 , 4 ],
220
+ [1 , 1 , 3 , 4 ],
221
+ [1 , 2 , 1 , 4 ],
222
+ [1 , 2 , 3 , 1 ]])
223
+ greyscale = [
224
+ 'rgb(0,0,0)' , # black
225
+ 'rgb(05,105,105)' , # dim grey
226
+ 'rgb(128,128,128)' , # grey
227
+ 'rgb(169,169,169)' , # dark grey
228
+ 'rgb(192,192,192)' , # silver
229
+ 'rgb(211,211,211)' , # light grey
230
+ 'rgb(220,220,220)' , # gainsboro
231
+ 'rgb(245,245,245)' ] # white smoke
232
+
233
+ dendro = tls .FigureFactory .create_dendrogram (X , colorscale = greyscale )
234
+ self .assertEqual (dendro ["data" ][0 ]['marker' ]['color' ],
235
+ 'rgb(128,128,128)' )
236
+ self .assertEqual (dendro ["data" ][1 ]['marker' ]['color' ],
237
+ 'rgb(128,128,128)' )
238
+ self .assertEqual (dendro ["data" ][2 ]['marker' ]['color' ],
239
+ 'rgb(0,0,0)' )
0 commit comments