Skip to content

-update dendrogram examples in docstring #334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 22, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 24 additions & 5 deletions plotly/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2453,26 +2453,45 @@ def create_dendrogram(X, orientation="bottom", labels=None,

Example 1: Simple bottom oriented dendrogram
```
import numpy as np

import plotly.plotly as py
from plotly.tools import FigureFactory as FF

X = np.random.rand(5,5)
import numpy as np

X = np.random.rand(10,10)
dendro = FF.create_dendrogram(X)
py.iplot(dendro, validate=False, height=300, width=1000)
plot_url = py.plot(dendro, filename='simple-dendrogram')

```

Example 2: Dendrogram to put on the left of the heatmap
```
import plotly.plotly as py
from plotly.tools import FigureFactory as FF

import numpy as np

X = np.random.rand(5,5)
names = ['Jack', 'Oxana', 'John', 'Chelsea', 'Mark']
dendro = FF.create_dendrogram(X, orientation='right', labels=names)
dendro['layout'].update({'width':700, 'height':500})

py.iplot(dendro, filename='vertical-dendrogram')
```

py.iplot(dendro, validate=False, height=1000, width=300)
Example 3: Dendrogram with Pandas
```
import plotly.plotly as py
from plotly.tools import FigureFactory as FF

import numpy as np
import pandas as pd

Index= ['A','B','C','D','E','F','G','H','I','J']
df = pd.DataFrame(abs(np.random.randn(10, 10)), index=Index)
fig = FF.create_dendrogram(df, labels=Index)
url = py.plot(fig, filename='pandas-dendrogram')
```
"""
dependencies = (_scipy_imported and _scipy__spatial_imported and
_scipy__cluster__hierarchy_imported)
Expand Down