Skip to content

Commit 6bb58b7

Browse files
author
mahdis-z
committed
count attribute
1 parent 136f1d4 commit 6bb58b7

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

python/sunburst-charts.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ fig.update_layout(margin = dict(t=0, l=0, r=0, b=0))
5656
fig.show()
5757
```
5858

59+
Here is the same example using [count](https://plot.ly/python/reference/#sunburst-count) attribute, that counts the number of `leaves` and/or `branches` when the `values` array is not provided.
60+
```python
61+
import plotly.graph_objects as go
62+
63+
fig =go.Figure(go.Sunburst(
64+
labels=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
65+
parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
66+
count = 'branches+leaves'
67+
))
68+
69+
fig.update_layout(margin = dict(t=0, l=0, r=0, b=0))
70+
71+
fig.show()
72+
```
73+
5974
### Sunburst with Repeated Labels
6075

6176
```python

python/treemaps.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ fig.show()
9797
### Set Color of Treemap Sectors
9898

9999
There are three different ways to change the color of the sectors in Treemap:
100-
1) [marker.colors](https://plot.ly/python/reference/#treemap-marker-colors), 2) [colorway](https://plot.ly/python/reference/#treemap-colorway), 3) [colorscale](https://plot.ly/python/reference/#treemap-colorscale). The following examples show how to use each of them.
100+
1) [marker.colors](https://plot.ly/python/reference/#treemap-marker-colors), 2) [colorway](https://plot.ly/python/reference/#treemap-colorway), 3) [colorscale](https://plot.ly/python/reference/#treemap-colorscale). The following examples show how to use each of them. [count](https://plot.ly/python/reference/#treemap-count) attribute counts the number of `leaves` and /or `branches` when the `value` array is not provided.
101101

102102
```python
103103
import plotly.graph_objects as go
@@ -108,6 +108,7 @@ parents = ["", "A1", "A2", "A3", "A4", "", "B1"]
108108
fig = go.Figure(go.Treemap(
109109
labels = labels,
110110
parents = parents,
111+
count = 'leaves+branches',
111112
marker_colors = ["pink", "royalblue", "lightgray", "purple", "cyan", "lightgray", "lightblue"]))
112113

113114
fig.show()

0 commit comments

Comments
 (0)