How to create a pie chart

Available on all plans:
  • Free
  • Pro
  • Business
  • Enterprise

A pie chart is useful when you want to show proportional parts of a whole. A pie chart should not have too many slices, as the chart otherwise gets cluttered and becomes hard to read – if you want to show more than five parts, consider grouping them or using a bar chart instead. Not sure if a pie chart is the right choice for your data? Read this article.

Below is an example of a pie chart that makes good use of the part-to-whole concept: We can see that more than half of German land is used for agriculture:

If you want to create this chart type, your data needs to be in a certain format. You'll need:

  • One header row containing descriptive labels.
  • One column containing at least two categories. This will determine the labels of the pie slices. In our case, that's "Housing & traffic", "Other land" etc.
  • One column containing numeric values. The values in the second column will define the size of the pie slices.

The most important thing you have to keep in mind is that a pie chart always represents a whole, i.e. 100%. Therefore, you can only use data that is based on exclusive values. Making a pie chart of a survey that allows multiple answers will lead to a misleading chart. In that case, it is better to opt for a bar chart instead of a pie chart.

Below is the data we used to create the chart at the top of the page:

Kind of land square km
Housing & traffic 49254
Other land 11300
Agriculture 182637
Forest 106170
Water 8219

Once you have prepared your data, create a new chart in Datawrapper. You can do so by going to our homepage and clicking on Start creating. In step 1: Upload, you can copy & paste your dataset, upload it as a .csv or Excel file, or connect to a Google Sheet. After pasting the data into Datawrapper, the text field on the right will look like this:

Click Proceed at the bottom right to go to the next step.

In the second step, you can check if your dataset was imported correctly and make changes to it – if necessary. If you did not upload a header row, you have to untick First row as label to avoid losing your first row of data. Always remember to do this if you don't have descriptive row and column headers.

In step 2: Check & Describe, your data should automatically be converted to rows and columns, like the figure below. You can see that Datawrapper correctly recognized your numbers as numbers (and not as text or dates) because they are colored in blue and are right-aligned. To learn more about Datawrapper's automatic recognition of data formats, visit this article.

To add a unit (like km/h, kg, inch, $, etc.) to your numbers, click on a column header and then add the unit of your choice to the Prepend/append options on the left. You can learn more about adding units to numbers here.

Click on Proceed at the bottom left to go to step 3: Visualize.

Now comes the fun part: You'll see a grid of different chart types under the tab Chart type. Odds are that when you clicked on Visualize your data was automatically shown as a line chart. To change that, click on the Pie chart symbol in the grid of available chart types:

Your data should now automatically be displayed as a pie chart but without a title, description or customized colors. The next step would be to further refine, annotate & define this chart. Besides Chart type, you'll notice three more tabs in this step: Refine, Annotate, and Layout.

In any tab of step 3: Visualize, you can click, hold, and drag the arrow in the lower right corner to scale the chart window or manually determine the dimension of the chart by entering values in the boxes below the chart (Size).

We recommend checking what the chart looks like on different screen sizes multiple times while designing it, by clicking on the little icons (mobile, tablet, and computer) below the chart.

Learn more about changing the width and height of your chart in this article.

Let's continue with the Refine tab. Here, we see four panels: Pie slices, Labels, Color legend, and Grouping.

The Pie slices panel lets you decide what your pie shows, which colors its slices have, and in which order they appear.

  • Select column: lets you choose the column with the numbers your pie should show. Datawrapper picks the first column with numbers (the default). A pie chart can only show one column, so if you want to show several, use the Multiple Pies chart type instead.
  • Slice color: sets one color for all slices. To give single slices their own colors, turn on Customize colors, click on one or several slices in the list, and pick a new color. All, none, and invert below the list help you select many slices at once, and Reset all changes undoes all your colors. In our chart, each kind of land gets a color that fits it, like green for forest and agriculture.
  • Pie size: sets how much of the available space the pie takes up. A smaller pie leaves more room around it and keeps the whole chart shorter. The default is 75%.
  • Sort by: shows the slices with the Largest first (the default) or the Smallest first. Choose Keep order to show them in the order of your dataset instead.

The Labels panel lets you decide which names and numbers appear on or next to your slices.

  • Number format: decides how the numbers appear, for example "1,992,394" or "1.9m". Learn more about all available number formats here.
  • Convert values to percentages: turns your numbers into shares of the whole. That's handy if you uploaded absolute numbers, like the square kilometers in our data, but want to show percentages.
  • Inside labels: shows labels inside the slices. With Show labels, they include the slice names, and with Show values, the numbers (both on by default).
  • Outside labels: shows labels outside of the pie (off by default). Datawrapper turns off the color legend when you use these outside labels.
<strong>Inside labels</strong> with <strong>Show labels</strong> and <strong>Show values</strong> turned on, and color key enabled (scroll down to learn more about how to enable the color key).
Inside labels with Show labels and Show values turned on, and color key enabled (scroll down to learn more about how to enable the color key).
<strong>Outside labels</strong> with <strong>Show values</strong> turned on. The color key turns off automatically when you turn on outside labels, since it's not needed anymore.
Outside labels with Show values turned on. The color key turns off automatically when you turn on outside labels, since it's not needed anymore.

The Color legend panel lets you add a list of your slice names to the chart.

  • Show color legend: lists the names of your slices next to the pie. Under Position, you can choose whether it appears at the top (the default), at the bottom, on the left, or on the right of the pie, like in our chart. On mobile, the color legend always appears at the top, no matter what you choose.
  • Stack labels: lists the names below each other instead of next to each other (off by default). You can only select to stack labels if the color legend is at the top or at the bottom – if the color legend is on the left or right, labels are stacked automatically.
  • Show values: adds the value of each slice to the color legend (off by default).

Here's how the color legend looks like if it's on the top or bottom, with Stack labels unchecked:

The Grouping panel lets you combine small slices, so your pie doesn't get too cluttered.

  • Maximum number of slices: groups the smallest slices into one if your data has more slices than this number (5 by default). Pie charts with many slices quickly get hard to read, so it's best to keep this number small.
  • Grouped slice label: names the slice that combines the smallest ones. If you leave it empty, Datawrapper calls it "Other".

In the Annotate tab, you're first asked to give your visualization a title, description, notes, source, byline, and an alternative description for screen readers. You can find a detailed explanation of all these Annotate options here.

In the 2nd panel in the Annotate tab, you can emphasize certain pie slices. All the other pie slices will then tone down in their color. To remove added elements, click on the little "x" left of the text in the blue button.

In the Layout tab, you can select an output locale, change the design theme and footer options, and enable social sharing. Find a detailed explanation of all the Layout options here.

In step 4: Publish & Embed, you can first publish your chart and then decide how it gets to your readers. We recommend pasting the embed code into your website or CMS, but you can also share the chart's URL. Learn more about both options here. To use your chart somewhere else, download it as a PNG (on any plan) or as an SVG or PDF (on paid plans). See what each plan includes on our pricing page.

And that's it! You've successfully created and customized a pie chart.

Last updated on May 11th, 2021