|
| 1 | +--- |
| 2 | +jupyter: |
| 3 | + jupytext: |
| 4 | + notebook_metadata_filter: all |
| 5 | + text_representation: |
| 6 | + extension: .md |
| 7 | + format_name: markdown |
| 8 | + format_version: '1.3' |
| 9 | + jupytext_version: 1.13.0 |
| 10 | + kernelspec: |
| 11 | + display_name: Python 3 (ipykernel) |
| 12 | + language: python |
| 13 | + name: python3 |
| 14 | + language_info: |
| 15 | + codemirror_mode: |
| 16 | + name: ipython |
| 17 | + version: 3 |
| 18 | + file_extension: .py |
| 19 | + mimetype: text/x-python |
| 20 | + name: python |
| 21 | + nbconvert_exporter: python |
| 22 | + pygments_lexer: ipython3 |
| 23 | + version: 3.9.7 |
| 24 | + plotly: |
| 25 | + display_as: bio |
| 26 | + language: python |
| 27 | + layout: base |
| 28 | + name: Clustergram |
| 29 | + order: 1 |
| 30 | + page_type: u-guide |
| 31 | + permalink: python/clustergram/ |
| 32 | + thumbnail: thumbnail/clustergram.png |
| 33 | +--- |
| 34 | + |
| 35 | +## Default Clustergram |
| 36 | +An example of a default Clustergram component without any extra properties. |
| 37 | + |
| 38 | + |
| 39 | +```python |
| 40 | +import pandas as pd |
| 41 | +import dash_bio |
| 42 | + |
| 43 | + |
| 44 | +df = pd.read_csv( |
| 45 | + 'https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Chromosomal/' + |
| 46 | + 'clustergram_brain_cancer.csv', |
| 47 | +) |
| 48 | + |
| 49 | +dash_bio.Clustergram( |
| 50 | + data=df, |
| 51 | + column_labels=list(df.columns.values), |
| 52 | + row_labels=list(df.index), |
| 53 | + height=800, |
| 54 | + width=700 |
| 55 | +) |
| 56 | +``` |
| 57 | + |
| 58 | +## Dendrogram Cluster Colors/Line Widths |
| 59 | +Change the colors of the dendrogram traces that are used to represent clusters, and configure their line widths. |
| 60 | + |
| 61 | + |
| 62 | +```python |
| 63 | +import pandas as pd |
| 64 | +import dash_bio |
| 65 | + |
| 66 | +df = pd.read_csv( |
| 67 | + 'https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Chromosomal/' + |
| 68 | + 'clustergram_brain_cancer.csv', |
| 69 | +) |
| 70 | + |
| 71 | +dash_bio.Clustergram( |
| 72 | + data=df, |
| 73 | + column_labels=list(df.columns.values), |
| 74 | + row_labels=list(df.index), |
| 75 | + height=800, |
| 76 | + width=700, |
| 77 | + color_list={ |
| 78 | + 'row': ['#636EFA', '#00CC96', '#19D3F3'], |
| 79 | + 'col': ['#AB63FA', '#EF553B'], |
| 80 | + 'bg': '#506784' |
| 81 | + }, |
| 82 | + line_width=2 |
| 83 | +) |
| 84 | +``` |
| 85 | + |
| 86 | +## Relative Dendrogram Size |
| 87 | +Change the relative width and height of, respectively, the row and column dendrograms compared to the width and height of the heatmap. |
| 88 | + |
| 89 | + |
| 90 | +```python |
| 91 | +import pandas as pd |
| 92 | +import dash_bio |
| 93 | + |
| 94 | +df = pd.read_csv( |
| 95 | + 'https://raw.githubusercontent.com/plotly/datasets/master/Dash_Bio/Chromosomal/' + |
| 96 | + 'clustergram_brain_cancer.csv', |
| 97 | +) |
| 98 | + |
| 99 | +dash_bio.Clustergram( |
| 100 | + data=df, |
| 101 | + column_labels=list(df.columns.values), |
| 102 | + row_labels=list(df.index), |
| 103 | + height=800, |
| 104 | + width=700, |
| 105 | + display_ratio=[0.1, 0.7] |
| 106 | +) |
| 107 | +``` |
| 108 | + |
| 109 | +## Circos with Dash |
| 110 | + |
| 111 | +```python |
| 112 | +from IPython.display import IFrame |
| 113 | +snippet_url = 'https://dash-gallery.plotly.host/python-docs-dash-snippets/' |
| 114 | +IFrame(snippet_url + 'bio-circos', width='100%', height=630) |
| 115 | +``` |
0 commit comments