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
Plotly's Python library is free and open source by downloading the client and[reading the primer](https://plot.ly/python/getting-started/).
31
-
<br>You can set up Plotly to work in[online](https://plot.ly/python/getting-started/#initialization-for-online-plotting) or[offline](https://plot.ly/python/getting-started/#initialization-for-offline-plotting) mode, or in[jupyter notebooks](https://plot.ly/python/getting-started/#start-plotting-online).
32
-
<br>We also have a quick-reference[cheatsheet](https://images.plot.ly/plotly-documentation/images/python_cheat_sheet.pdf) (new!) to help you get started!
40
+
###Basic Pie Chart ###
41
+
42
+
A pie chart``go.Pie`` object is a circular statistical chart, which is divided into sectors to illustrate numerical proportion. Data visualized by the sectors of the pie is set in`values`. The sector labels are set in`labels`. The sector colors are set in`marker.colors`.
This example uses a[plotly grid attribute](https://plot.ly/python/reference/#layout-grid) for the suplots. Reference the row and column destination using the[domain](https://plot.ly/python/reference/#pie-domain) attribute.
fig.update(layout_title_text='Van Gogh: 5 Most Prominent Colors Shown Proportionally',
144
+
layout_showlegend=False)
145
+
146
+
fig= go.Figure(fig)
147
+
fig.show()
151
148
```
152
149
153
-
###Pie Chart Subplots ###
154
-
150
+
####Plot chart with area proportional to total count
155
151
156
-
In order to create pie chart subplots, you need to usethe[domain](https://plot.ly/python/reference/#pie-domain) attribute. It is important to note that the`X` array set the horizontal position whilst the`Y` array sets the vertical. For example,`x: [0,0.5], y: [0, 0.5]` would mean the bottom left position of the plot.
152
+
Plots inthesame`scalegroup` are represented with an area proportional to their total size.
157
153
158
154
```python
159
-
import plotly.plotlyas py
160
-
import plotly.graph_objsas go
161
-
162
-
fig= {
163
-
'data': [
164
-
{
165
-
'labels': ['1st','2nd','3rd','4th','5th'],
166
-
'values': [38,27,18,10,7],
167
-
'type':'pie',
168
-
'name':'Starry Night',
169
-
'marker': {'colors': ['rgb(56, 75, 126)',
170
-
'rgb(18, 36, 37)',
171
-
'rgb(34, 53, 101)',
172
-
'rgb(36, 55, 57)',
173
-
'rgb(6, 4, 4)']},
174
-
'domain': {'x': [0,.48],
175
-
'y': [0,.49]},
176
-
'hoverinfo':'label+percent+name',
177
-
'textinfo':'none'
178
-
},
179
-
{
180
-
'labels': ['1st','2nd','3rd','4th','5th'],
181
-
'values': [28,26,21,15,10],
182
-
'marker': {'colors': ['rgb(177, 127, 38)',
183
-
'rgb(205, 152, 36)',
184
-
'rgb(99, 79, 37)',
185
-
'rgb(129, 180, 179)',
186
-
'rgb(124, 103, 37)']},
187
-
'type':'pie',
188
-
'name':'Sunflowers',
189
-
'domain': {'x': [.52,1],
190
-
'y': [0,.49]},
191
-
'hoverinfo':'label+percent+name',
192
-
'textinfo':'none'
193
-
194
-
},
195
-
{
196
-
'labels': ['1st','2nd','3rd','4th','5th'],
197
-
'values': [38,19,16,14,13],
198
-
'marker': {'colors': ['rgb(33, 75, 99)',
199
-
'rgb(79, 129, 102)',
200
-
'rgb(151, 179, 100)',
201
-
'rgb(175, 49, 35)',
202
-
'rgb(36, 73, 147)']},
203
-
'type':'pie',
204
-
'name':'Irises',
205
-
'domain': {'x': [0,.48],
206
-
'y': [.51,1]},
207
-
'hoverinfo':'label+percent+name',
208
-
'textinfo':'none'
209
-
},
210
-
{
211
-
'labels': ['1st','2nd','3rd','4th','5th'],
212
-
'values': [31,24,19,18,8],
213
-
'marker': {'colors': ['rgb(146, 123, 21)',
214
-
'rgb(177, 180, 34)',
215
-
'rgb(206, 206, 40)',
216
-
'rgb(175, 51, 21)',
217
-
'rgb(35, 36, 21)']},
218
-
'type':'pie',
219
-
'name':'The Night Café',
220
-
'domain': {'x': [.52,1],
221
-
'y': [.51,1]},
222
-
'hoverinfo':'label+percent+name',
223
-
'textinfo':'none'
224
-
}
225
-
],
226
-
'layout': {'title':'Van Gogh: 5 Most Prominent Colors Shown Proportionally',