Questions tagged [pie-chart]

A pie chart is a circular representation of data divided into sections by the drawing of radii.

A pie chart is a circular representation of data divided into sections by the drawing of radii.

  • Each section represents a percentage of some total.
  • The sum of the values of all sections is 100% of the total.
  • The sizes of the sections are directly proportional to the percentage of the total.
  • For example, if a given section represented 10% of the total value, the central angle of the section would be 36 degrees, or 10% of the total 360 degrees in the chart.

Questions regarding pie charts as used in programming should use this tag.

However, some aren't considering pie charts as the best option to visualize data. Often data which is visualized with pie-charts can be visualized with bar-charts as well.

In scientific software for statistical computing and graphics, function pie generates a pie chart.

Useful links


Related tags

3007 questions
88
votes
7 answers

How do I use matplotlib autopct?

I'd like to create a matplotlib pie chart which has the value of each wedge written on top of the wedge. The documentation suggests I should use autopct to do this. autopct: [ None | format string | format function ] If not None, is a…
Kim
  • 3,316
  • 5
  • 25
  • 28
62
votes
2 answers

How to set the labels size on a pie chart

I want to have labels with small size on a piechart in python to improve visibility here is the code import matplotlib.pyplot as plt frac=[1.40 , 10.86 , 19.31 , 4.02 , 1.43 , 2.66 , 4.70 , 0.70 , 0.13 , 1.48, 32.96 , 1.11 , 13.30 ,…
Piccolo
  • 1,022
  • 2
  • 13
  • 15
60
votes
1 answer

percent label position in pie chart

Is there a way to change the default position of the percent label in a matplotlib pie chart? Here is an example pie chart: Which I have created using: plt.pie(sizes, labels=labels, colors=colors, explode=explode, autopct='%1.0f%%') Now I don't…
Daniel
  • 8,179
  • 6
  • 31
  • 56
46
votes
8 answers

Label outside arc (Pie chart) d3.js

I'm new to d3.js and I"m trying to make a Pie-chart with it. I have only one problem: I can't get my labels outside my arcs... The labels are positioned with arc.centroid arcs.append("svg:text") .attr("transform", function(d) { return…
Ibe Vanmeenen
  • 938
  • 1
  • 11
  • 23
45
votes
1 answer

Legend overlaps with the pie chart

Using matplotlib in python. The legend overlaps with my pie chart. Tried various options for "loc" such as "best" ,1,2,3... but to no avail. Any Suggestions as to how to either exactly mention the legend position (such as giving padding from the pie…
cassandra
  • 597
  • 1
  • 6
  • 9
45
votes
4 answers

How to avoid overlapping of labels & autopct in a pie chart

My Python code is: values = [234, 64, 54,10, 0, 1, 0, 9, 2, 1, 7, 7] months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul','Aug','Sep','Oct', 'Nov','Dec'] colors = ['yellowgreen', 'red', 'gold', 'lightskyblue', …
Adithya
  • 1,687
  • 3
  • 19
  • 34
40
votes
9 answers

nvd3 piechart.js - How to edit the tooltip?

I'm using nvd3's piechart.js component to generate a piechart on my site. The provided .js file includes several var's, as follows: var margin = {top: 30, right: 20, bottom: 20, left: 20} , width = null , height = null , showLegend =…
kage23
  • 401
  • 1
  • 4
  • 3
39
votes
8 answers

ggplot2 pie and donut chart on same plot

I am trying to replicate this with R ggplot. I have exactly the same data: browsers<-structure(list(browser = structure(c(3L, 3L, 3L, 3L, 2L, 2L, 2L, 1L, 5L, 5L, 4L), .Label = c("Chrome", "Firefox", "MSIE", "Opera", "Safari"), class = "factor"),…
Tavi
  • 2,668
  • 11
  • 27
  • 41
36
votes
2 answers

pandas pie chart plot remove the label text on the wedge

the pie chart example on pandas plotting tutorial http://pandas.pydata.org/pandas-docs/version/0.15.0/visualization.html generates the following figure: with this code: import matplotlib.pyplot as plt plt.style.use('ggplot') import numpy as…
fast tooth
  • 2,317
  • 4
  • 25
  • 34
35
votes
3 answers

Python matplotlib.pyplot pie charts: How to remove the label on the left side?

I plot a piechart using pyplot. import pylab import pandas as pd test = pd.Series(['male', 'male', 'male', 'male', 'female'], name="Sex") test = test.astype("category") groups = test.groupby([test]).agg(len) groups.plot(kind='pie',…
Marc
  • 383
  • 1
  • 3
  • 8
32
votes
5 answers

Chart.js v2: How to make tooltips always appear on pie chart?

I have found similar questions in Stack Overflow, but all of them were addressed one and two years ago. Now Chart.js has come up in version 2, and lots of the documentation changes. Can someone please help me showing an example of pie chart with…
Danny
  • 543
  • 1
  • 5
  • 14
30
votes
4 answers

HTML5 Canvas pie chart

I'm attempting to create a simple pie chart like shown in the graphic below: The chart will show the results for a quiz where a user can choose either a, b or c. They're 10 questions and the user can only choose one option per question. What I want…
Cameron
  • 27,963
  • 100
  • 281
  • 483
30
votes
7 answers

Flot pie chart gives error in firebug: "uncaught exception: Invalid dimensions for plot, width = null, height = null"

I using flot pie chart for plotting pie charts. but it shows error in firebug that uncaught exception: Invalid dimensions for plot, width = null, height = null I have given the height and width from stylesheet also. and tried also like this…
user1662343
  • 303
  • 1
  • 3
  • 4
29
votes
4 answers

Pie Chart Legend - Chart.js

I need help to put the number of the pie chart in the legend Chart Image If i hover the chart with mouse i can see the number relative to each item i want to display it in the legend either the important code so far: var tempData = { labels:…
dpanegassi
  • 649
  • 4
  • 8
  • 15
26
votes
2 answers

How to have actual values in matplotlib Pie Chart displayed

I have a pie chart drawing the values extracted from a CSV file. The proportion of the values are currently displayed with the percentage displayed "autopct='%1.1f%%'". Is there a way to display the actual values which are represented in the dataset…
Anthony J
  • 551
  • 1
  • 9
  • 19
1
2 3
99 100