@@ -2434,7 +2434,7 @@ def create_dendrogram(X, orientation="bottom", labels=None,
2434
2434
:param (str) orientation: 'top', 'right', 'bottom', or 'left'
2435
2435
:param (list) labels: List of axis category labels(observation labels)
2436
2436
:param (list) colorscale: Optional colorscale for dendrogram tree
2437
- clusters
2437
+ clusters
2438
2438
2439
2439
Example 1: Simple bottom oriented dendrogram
2440
2440
```
@@ -2457,6 +2457,7 @@ def create_dendrogram(X, orientation="bottom", labels=None,
2457
2457
2458
2458
py.iplot(dendro, validate=False, height=1000, width=300)
2459
2459
```
2460
+
2460
2461
"""
2461
2462
dependencies = (_scipy_imported and _scipy__spatial_imported and
2462
2463
_scipy__cluster__hierarchy_imported )
@@ -3204,10 +3205,7 @@ def make_rug(self):
3204
3205
3205
3206
3206
3207
class _Dendrogram (FigureFactory ):
3207
-
3208
- """
3209
- Refer to FigureFactory.create_dendrogram() for docstring.
3210
- """
3208
+ """Refer to FigureFactory.create_dendrogram() for docstring."""
3211
3209
3212
3210
def __init__ (self , X , orientation = 'bottom' , labels = None , colorscale = None ,
3213
3211
width = "100%" , height = "100%" , xaxis = 'xaxis' , yaxis = 'yaxis' ):
@@ -3253,11 +3251,11 @@ def __init__(self, X, orientation='bottom', labels=None, colorscale=None,
3253
3251
3254
3252
def get_color_dict (self , colorscale ):
3255
3253
"""
3256
- Returns colorscale used for dendrogram tree clusters
3257
- :param (list) colorscale: colors to use for the plot,
3258
- in rgb format
3259
- :rtype (dict): returns a dictionary of default colors mapped
3260
- to the user colorscale
3254
+ Returns colorscale used for dendrogram tree clusters.
3255
+
3256
+ :param (list) colorscale: Colors to use for the plot in rgb format.
3257
+ :rtype (dict): A dict of default colors mapped to the user colorscale.
3258
+
3261
3259
"""
3262
3260
3263
3261
# These are the color codes returned for dendrograms
@@ -3292,11 +3290,12 @@ def get_color_dict(self, colorscale):
3292
3290
3293
3291
def set_axis_layout (self , axis_key ):
3294
3292
"""
3295
- Sets and returns default axis object for dendrogram figure
3296
- :param (str) axis_key: "xaxis", "xaxis1", "yaxis", yaxis1", etc.
3297
- :rtype (dict): returns an axis_key dictionary with set parameters
3298
- """
3293
+ Sets and returns default axis object for dendrogram figure.
3299
3294
3295
+ :param (str) axis_key: E.g., 'xaxis', 'xaxis1', 'yaxis', yaxis1', etc.
3296
+ :rtype (dict): An axis_key dictionary with set parameters.
3297
+
3298
+ """
3300
3299
axis_defaults = {
3301
3300
'type' : 'linear' ,
3302
3301
'ticks' : 'outside' ,
@@ -3325,9 +3324,9 @@ def set_axis_layout(self, axis_key):
3325
3324
3326
3325
def set_figure_layout (self , width , height ):
3327
3326
"""
3328
- Sets and returns default layout object for dendrogram figure
3329
- """
3327
+ Sets and returns default layout object for dendrogram figure.
3330
3328
3329
+ """
3331
3330
self .layout .update ({
3332
3331
'showlegend' : False ,
3333
3332
'autoscale' : False ,
@@ -3343,21 +3342,20 @@ def set_figure_layout(self, width, height):
3343
3342
3344
3343
def get_dendrogram_traces (self , X , colorscale ):
3345
3344
"""
3346
- Calculates all the elements needed for plotting a dendrogram
3345
+ Calculates all the elements needed for plotting a dendrogram.
3347
3346
3348
3347
:param (ndarray) X: Matrix of observations as arrray of arrays
3349
- :param (list) colorscale: Optional colorscale for dendrogram tree
3350
- clusters
3351
-
3352
- :rtype (tuple): Contains all the traces in the following order
3353
- (a) trace_list: List of Plotly trace objects for the dendrogram tree
3354
- (b) icoord: All X points of the dendogram tree as array of arrays
3355
- with length 4
3356
- (c) dcoord: All Y points of the dendogram tree as array of arrays
3357
- with length 4
3358
- (d) ordered_labels: leaf labels in the order they are going to
3359
- appear on the plot
3360
- (e) P['leaves']: left-to-right traversal of the leaves
3348
+ :param (list) colorscale: Colorscale for dendrogram tree clusters
3349
+ :rtype (tuple): Contains all the traces in the following order:
3350
+ (a) trace_list: List of Plotly trace objects for dendrogram tree
3351
+ (b) icoord: All X points of the dendogram tree as array of arrays
3352
+ with length 4
3353
+ (c) dcoord: All Y points of the dendogram tree as array of arrays
3354
+ with length 4
3355
+ (d) ordered_labels: leaf labels in the order they are going to
3356
+ appear on the plot
3357
+ (e) P['leaves']: left-to-right traversal of the leaves
3358
+
3361
3359
"""
3362
3360
# TODO: protected until #282
3363
3361
from plotly .graph_objs import graph_objs
0 commit comments