饼图(Pie)是一种常见的数据可视化类型。饼图(Pie)可以让其他人更容易理解您呈现的数据。馅饼的每一片都是一个组成部分,所有组成部分加起来就是整个馅饼。换句话说,当您的数据集加起来达到 100% 时,饼图最有用。
几乎所有电子表格软件都提供了一种创建饼图的方法。今天我们将专注于在Microsoft Excel(Microsoft Excel)中创建饼图。
如何在 Excel 中创建饼图
Microsoft Excel是办公电子表格软件的黄金标准。我们将使用桌面应用程序,但您可以选择使用网络版本。毕竟,Microsoft Office网络套件是免费提供的!让我们看看如何从Excel(Excel)中的数据创建饼图。
- 从您的数据开始(Start)。在这个例子中,我们看到每个玩家在一个晚上的扑克游戏中赢得的总金额。
- 选择插入选项卡,然后在功能区的(Insert)图表(Charts )组中选择饼图命令。
- 选择二维饼图(2-D Pie)选项。
- 您将看到许多可用的饼图选项。现在,让我们选择基本的二维饼图。只要您选择二维饼图图标,Excel就会在您的工作表中生成一个饼图。
您刚刚创建了一个饼图!接下来,我们将探索调整饼图的外观。
格式化饼图
Excel提供了几种格式化饼图的方法。
您可以根据需要更改图表标题(Chart Title)。Excel会自动使用存储图表数据的列的标题——在本例中为“扑克奖金”。如果您更新该列标题的文本,饼图的标题将自动更新。或者,您可以双击图表标题本身并进行编辑。
您还应该以正确的顺序排列数据。想象一个模拟时钟叠加在您的饼图之上。馅饼的最大部分应该在 12:00 开始。当你绕着馅饼顺时针转动时,切片应该逐渐变小。为了做到这一点,您需要将数字数据从大到小排序。
选择主页(Home)菜单项。确保(Make)您的光标位于包含数字数据的列中的一个单元格中。选择功能区上的排序和筛选(Sort & Filter)按钮,然后选择从最大到最小排序(Sort Largest to Smallest)。
您的饼图将自动更新,现在您正在遵循有关饼图中数据顺序的最佳实践。
选择您的数据标签(Data Labels)。首先单击饼图并选择图表右侧的绿色加号图标以显示图表元素(Chart Elements)。
现在选中Data Labels(Data Labels)旁边的框。
展开数据标签(Data Labels)的选项,然后选择更多选项...(More Options…)
这将打开“格式化数据标签(Format Data Labels)”面板。
Excel 饼图标签的工作原理
您可以在“格式化数据标签(Format Data Labels)”面板中选择将在饼图中显示的标签。
选择名为标签选项(Label Options)的条形图图标。
展开标签选项(Label Options)部分,您将看到许多标签,您可以选择在饼图中显示。
以下是每个标签选项的工作原理:
- 来自单元格的值(Value from Cells):在上面的示例中,饼图显示一列数据。如果您有另一列数据,则可以使用此选项在标记饼图的每个切片时使用这些值。
换句话说,您可以选择使用来自不同单元格范围的数据作为数据标签。例如,您可以在数据中添加第三列,“上周的变化”。(Change)如果您从单元格中选择值(value from cells)并选择单元格 C2:C6,那么您的饼图将如下所示:
- 系列名称:(Series Name: )选中此选项会将数据列的标题添加到饼图的每个切片中。在我们的示例中,馅饼的每一块都会有一个标签,上面写着“扑克赢钱(Poker Winnings)”。
- 分类名称:(Category Name: )推荐这个。此选项无需参考图例,而是使用类别值标记饼图的每个切片。
- 值:(Value: )这是自动检查的。饼图的每个切片都标有与该幻灯片对应的数据值。在我们的示例中,这是每个扑克玩家赢得的美元金额。
- 百分比(Percentage):这通常非常有用。切片占整个馅饼的百分比是多少?选中此框将确保切片标记有切片所代表的百分比。
- 显示前导线:(Show Leader Lines: )如果数据标签不完全适合切片,此选项将添加一条将数据标签连接到切片的线。
- 图例键(Legend Key):如果您没有启用类别名称(Category Name ),请务必选中此框,以便图例显示在饼图的底部。
更改饼图颜色
要更改饼图配色方案,请先选择饼图。然后选择画笔图标,图表样式。 (Chart Styles. )
您将看到两个选项卡,样式(Style)和颜色(Colors)。探索两个选项卡中的选项并选择您喜欢的配色方案。
如果要突出显示饼图的特定切片,请为该切片应用颜色,同时为所有其他切片选择灰色阴影。
您可以选择饼图的单个切片,然后单击要格式化的切片。您还可以将要突出显示的切片稍微远离中心以引起注意,如下所示:
更改饼图类型
要更改图表类型,请选择功能区上的设计(Design )选项卡,然后选择更改图表类型(Change Chart Type)。
例如,选择圆环图(Donut Chart)。
现在我们的示例饼图如下所示:
Excel中的其他类型的图表
既然您已了解在Excel(Excel)中创建饼图的基础知识,请查看我们的文章“绘制 Excel 数据图表(Charting Your Excel Data)”,了解有关如何以清晰、引人注目的方式呈现数据可视化的更多提示和技巧。
How to Make a Pie Chart in Excel
Pie charts are a common type of data visualization. Pie charts cаn make it easier for others to understand the data you’re presеnting. Each slice of the pie is one componеnt, and the components аll add up to the whole pie. In other words, pie charts are most useful when you have dаta sets that add up to 100%.
Virtually all spreadsheet software offers a way to create pie charts. Today we’ll focus on creating pie charts in Microsoft Excel.
How to Create a Pie Chart in Excel
Microsoft Excel is the gold standard of office spreadsheet software. We’ll be using the desktop application, but you can opt to use the web version. After all, the Microsoft Office suite for the web is available for free! Let’s look at how to create a pie chart from your data in Excel.
- Start with your data. In this example, we see the total amount of money that each player has won during an evening of poker.
- Select the Insert tab, and then select the pie chart command in the Charts group on the ribbon.
- Select the 2-D Pie option.
- You’ll see a number of pie chart options available. For now, let’s choose the basic 2-D pie chart. As soon as you select the 2-D pie icon, Excel will generate a pie chart inside your worksheet.
You have just created a pie chart! Next we’ll explore adjusting the look and feel of your pie chart.
Formatting Your Pie Chart
Excel offers several ways to format pie charts.
You can change the Chart Title if you like. Excel automatically uses the header of the column where your chart data is stored—in this case, “Poker Winnings.” If you update the text of that column’s header, the pie chart’s title will update automatically. Alternatively, you can double-click on the chart title itself and edit it.
You should also put your data in the right order. Imagine an analog clock superimposed on top of your pie chart. The biggest slice of the pie should begin at 12:00. As you go clockwise around the pie, the slices should get progressively smaller. In order to accomplish this, you need to sort your numerical data from largest to smallest.
Select the Home menu item. Make sure your cursor is in one of the cells in the column with numerical data. Select the Sort & Filter button on the ribbon and choose Sort Largest to Smallest.
Your pie chart will automatically update, and now you’re following best practices regarding the order of your data within the pie chart.
Choose your Data Labels. Begin by clicking on the pie chart and selecting the green plus icon to the right of the chart to display Chart Elements.
Now check the box next to Data Labels.
Expand the options for Data Labels and then select More Options…
That will open the Format Data Labels panel.
How Excel Pie Chart Labels Work
The Format Data Labels panel is where you can choose which labels will appear on your pie chart.
Select the bar graph icon called Label Options.
Expand the Label Options section and you’ll see a number of labels you can choose to display on your pie chart.
Here’s how each label option works:
- Value from Cells: In the example above, the pie chart displays one column of data. If you had another column of data, you could use this option to use those values when labeling each slice of the pie.
In other words, you can choose to use the data from a different range of cells as your data labels. For example, you can add a third column to your data, “Change from last week.” If you choose value from cells and select cells C2:C6, then your pie chart would look like this:
- Series Name: Checking this option will add the heading of your data column to every slice of the pie. In our example, each slice of the pie would get a label saying “Poker Winnings.”
- Category Name: This one is recommended. Instead of having to refer to the legend, this option will label each slice of the pie with the category values.
- Value: This is checked automatically. Each slice of the pie is labeled with the data value corresponding to that slide. In our example, that’s the dollar amount each poker player won.
- Percentage: This is often very useful. What percentage of the whole pie does the slice represent? Checking this box will ensure that the slice is labeled with the percentage the slice represents.
- Show Leader Lines: If the data label won’t fit entirely inside the slice, this option will add a line connecting the data label to the slice.
- Legend Key: If you don’t have Category Name enabled, be sure to check this box so the legend appears at the bottom of your pie chart.
Changing Pie Chart Colors
To change your pie chart color scheme, begin by selecting the pie chart. Then select the paintbrush icon, Chart Styles.
You’ll see two tabs, Style and Colors. Explore the options in both tabs and choose a color scheme you like.
If you want to highlight a specific slice of the pie, apply a color to that slice while choosing a shade of gray for all the other slices.
You can select a single slice of the pie by selecting the pie chart and then clicking on the slice you want to format. You can also move the slice you want to highlight slightly away from the center to call attention to it like this:
Changing Pie Chart Type
To change the chart type, select the Design tab on the ribbon and select Change Chart Type.
For example, select the Donut Chart.
Now our example pie chart looks like this:
Other Kinds of Charts in Excel
Now that you know the basics of creating a pie chart in Excel, check out our article, “Charting Your Excel Data” to learn more tips and tricks on how to present your data visualizations in clear, compelling ways.