diff --git a/python/sunburst-charts.md b/python/sunburst-charts.md index 43edfe028..19c480143 100644 --- a/python/sunburst-charts.md +++ b/python/sunburst-charts.md @@ -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 diff --git a/python/treemaps.md b/python/treemaps.md index a241a1198..5e2cee83b 100644 --- a/python/treemaps.md +++ b/python/treemaps.md @@ -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 @@ -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()