Skip to content

count attribute #213

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
Dec 1, 2019
Merged
Show file tree
Hide file tree
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
15 changes: 15 additions & 0 deletions python/sunburst-charts.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,22 @@ fig.update_layout(margin = dict(t=0, l=0, r=0, b=0))

fig.show()
```
### Setting the width of wedges with count

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. The default value of count is `leaves`.
```python
import plotly.graph_objects as go

fig =go.Figure(go.Sunburst(
labels=["Eve", "Cain", "Seth", "Enos", "Noam", "Abel", "Awan", "Enoch", "Azura"],
parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve" ],
count = 'branches+leaves'
))

fig.update_layout(margin = dict(t=0, l=0, r=0, b=0))

fig.show()
```
### Sunburst with Repeated Labels

```python
Expand Down
3 changes: 2 additions & 1 deletion python/treemaps.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ fig.show()
### Set Color of Treemap Sectors

There are three different ways to change the color of the sectors in Treemap:
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.
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.

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

fig.show()
Expand Down