8000 -update dendrogram examples in docstring · skytree-brian/plotly.py@e86b414 · GitHub
[go: up one dir, main page]

Skip to content

Commit e86b414

Browse files
committed
-update dendrogram examples in docstring
1 parent a4a62e3 commit e86b414

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

plotly/tools.py

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,26 +2453,45 @@ def create_dendrogram(X, orientation="bottom", labels=None,
24532453
24542454
Example 1: Simple bottom oriented dendrogram
24552455
```
2456-
import numpy as np
2457-
24582456
import plotly.plotly as py
24592457
from plotly.tools import FigureFactory as FF
24602458
2461-
X = np.random.rand(5,5)
2459+
import numpy as np
2460+
2461+
X = np.random.rand(10,10)
24622462
dendro = FF.create_dendrogram(X)
2463-
py.iplot(dendro, validate=False, height=300, width=1000)
2463+
plot_url = py.plot(dendro, filename='simple-dendrogram')
24642464
24652465
```
24662466
24672467
Example 2: Dendrogram to put on the left of the heatmap
24682468
```
2469+
import plotly.plotly as py
2470+
from plotly.tools import FigureFactory as FF
2471+
2472+
import numpy as np
2473+
24692474
X = np.random.rand(5,5)
24702475
names = ['Jack', 'Oxana', 'John', 'Chelsea', 'Mark']
24712476
dendro = FF.create_dendrogram(X, orientation='right', labels=names)
2477+
dendro['layout'].update({'width':700, 'height':500})
2478+
2479+
py.iplot(dendro, filename='vertical-dendrogram')
2480+
```
24722481
2473-
py.iplot(dendro, validate=False, height=1000, width=300)
2482+
Example 3: Dendrogram with Pandas
24742483
```
2484+
import plotly.plotly as py
2485+
from plotly.tools import FigureFactory as FF
24752486
2487+
import numpy as np
2488+
import pandas as pd
2489+
2490+
Index= ['A','B','C','D','E','F','G','H','I','J']
2491+
df = pd.DataFrame(abs(np.random.randn(10, 10)), index=Index)
2492+
fig = FF.create_dendrogram(df, labels=Index)
2493+
url = py.plot(fig, filename='pandas-dendrogram')
2494+
```
24762495
"""
24772496
dependencies = (_scipy_imported and _scipy__spatial_imported and
24782497
_scipy__cluster__hierarchy_imported)

0 commit comments

Comments
 (0)
0