You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/python/icicle-charts.md
+123-26
Original file line number
Diff line number
Diff line change
@@ -27,13 +27,13 @@ jupyter:
27
27
language: python
28
28
layout: base
29
29
name: Icicle Charts
30
-
order: 10
30
+
order: 13.5
31
31
page_type: u-guide
32
32
permalink: python/icicle-charts/
33
-
thumbnail: thumbnail/icicle.gif
33
+
thumbnail: thumbnail/icicle.png
34
34
---
35
35
36
-
Similar to Treemap plots and Icicle plots, Icicle plots provide yet another way to visualize hierarchical data. Children are drawn next to their parent boxes, all on one side (eg. each on the right side of their parent). Icicle plots can point in one of four directions (left, right, top, bottom); this direction is acheived with the `tiling` sub-attributes `orientation` and `flip`.
36
+
Icicle charts visualize hierarchical data using rectangular sectors that cascade from root to leaves in one of four directions: up, down, left, or right. Similar to [Sunburst](https://plotly.com/python/sunburst-charts/) and [Treemap](https://plotly.com/python/treemaps/) charts, the hierarchy is defined by `labels` (`names` for `px.icicle`) and `parents` attributes. Click on one sector to zoom in/out, which also displays a pathbar on the top of your icicle. To zoom out, you can click the parent sector or click the pathbar as well.
37
37
38
38
Main arguments:
39
39
@@ -43,16 +43,106 @@ Main arguments:
43
43
44
44
### Basic Icicle Plot with plotly.express
45
45
46
+
[Plotly Express](/python/plotly-express/) is the easy-to-use, high-level interface to Plotly, which [operates on a variety of types of data](/python/px-arguments/) and produces [easy-to-style figures](/python/styling-plotly-express/).
47
+
48
+
With `px.icicle`, each item in the `character` list is represented as a rectangular sector of the icicle.
### Icicle of a rectangular DataFrame with plotly.express
47
67
68
+
Hierarchical data are often stored as a rectangular dataframe, with different columns corresponding to different levels of the hierarchy. `px.icicle` can take a path parameter corresponding to a list of columns. Note that `id` and `parent` should not be provided if path is given.
### Icicle of a rectangular DataFrame with discrete color argument in px.icicle
51
94
95
+
When the argument of color corresponds to non-numerical data, discrete colors are used. If a sector has the same value of the color column for all its children, then the corresponding color is used, otherwise the first color of the discrete color sequence is used.
In the example below the color of **Saturday** and **Sunday** sectors is the same as **Dinner** because there are only Dinner entries for Saturday and Sunday. However, for Female -> Friday there are both lunches and dinners, hence the "mixed" color (blue here) is used.
If the dataset is not fully rectangular, missing values should be supplied as **None**. Note that the parents of **None** entries must be a leaf, i.e. it cannot have other children than **None** (otherwise a **ValueError** is raised).
If Plotly Express does not provide a good starting point, it is also possible to use [the more generic `go.Icicle` class from `plotly.graph_objects`](/python/graph-objects/).
Similar to [treemaps](https://plotly.com/python/treemaps/), the space between each Icicle slice can be set with `pad`, a sub-attribute of the `tiling` attribute.
511
+
Similar to [treemaps](https://plotly.com/python/treemaps/), the space between each Icicle slice can be set with `pad`, one of the sub-attributes of the `tiling` attribute.
0 commit comments