From a61554f1373097d32d9933d99fa90de00f42b56f Mon Sep 17 00:00:00 2001 From: Emmanuelle Gouillart Date: Tue, 3 Dec 2019 14:58:37 -0500 Subject: [PATCH] pull example in pie chart --- doc/python/pie-charts.md | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/doc/python/pie-charts.md b/doc/python/pie-charts.md index 8eb73f20fe6..ca22c48a1f7 100644 --- a/doc/python/pie-charts.md +++ b/doc/python/pie-charts.md @@ -31,7 +31,6 @@ jupyter: page_type: example_index permalink: python/pie-charts/ thumbnail: thumbnail/pie-chart.jpg - redirect_from: /python/pie/ --- ### Basic Pie Chart ### @@ -80,6 +79,21 @@ fig = go.Figure(data=[go.Pie(labels=labels, values=values, hole=.3)]) fig.show() ``` +### Pulling sectors out from the center + +For a "pulled-out" or "exploded" layout of the pie chart, use the `pull` argument. It can be a scalar for pulling all sectors or an array to pull only some of the sectors. + +```python +import plotly.graph_objects as go + +labels = ['Oxygen','Hydrogen','Carbon_Dioxide','Nitrogen'] +values = [4500, 2500, 1053, 500] + +# pull is given as a fraction of the pie radius +fig = go.Figure(data=[go.Pie(labels=labels, values=values, pull=[0, 0, 0.2, 0])]) +fig.show() +``` + ### Pie Charts in subplots ```python