直方图是一种可以从Excel中的数据生成的图表。它可以很容易地总结数据集中特定值的频率。Excel使创建直方图变得简单,假设直方图实际上是您所需要的!
什么是直方图?
直方图是一种使用垂直条来汇总数据范围的图表。虽然它可能看起来像条形图(bar chart),但存在显着差异。条形图(Bar)显示变量之间的差异,而直方图通常用于根据另一个变量显示变量之间的差异。
为了说明这一点,可以使用直方图向我们展示 IQ 分数的常见范围。每个条形代表一个“bin”或分数范围。所以像0-10,11-20等。
垂直 Y 轴向我们展示了该变量的多少测量值落在每个 bin 范围内。因此,如果您有 100 个人进行 IQ 测试,那么每个分数落在特定分类中的人都会计入该分类的频率分数。
使用条形图,您可能想要比较国家之间的平均智商分数等内容。在这种情况下,每个条形可能代表一个国家,垂直Y 轴(Y-axis)代表该国家的平均智商。
什么时候应该使用直方图?
直方图是频率分布的可视化。它可以帮助您一目了然地了解您的数据具有什么样的分布。例如,“正态分布”具有独特的钟形曲线外观。双峰分布将有两个凸起。您还可以查看分数频率是否以一种或另一种方式倾斜。
当然,如果您真的想确定您的频率分布是否正常,您可以在Excel 中(Excel)对您的数据进行正态性检验。这些测试仍然使用直方图作为基础,创建和观察直方图是向您大致展示您可能正在处理的分布类型的关键第一步。
制作直方图需要什么
为了制作直方图,您需要做一些事情:
第一个要求相当简单。例如,如果您有一组人的体重,您将在数据集中记录每个测量的体重。注意不要将您不想测量的组中的数据混合到一个直方图中。例如,如果您只想查看某个年龄组或性别的体重分布,您应该只包含该组的数据。
如果您想在单个变量上比较两组之间的频率分布,则需要多个直方图。每个人口组一个。
所有关于垃圾箱(All About Bins)
下一个要求是最棘手的。您需要确定频率计数将被分类到的“箱”。问题是这些可能是任意的。如果您要查看分数在 0 到 100 之间的频率,您可以有 100 个分箱,每个分箱对应一个可能的分数。但是,这意味着您的直方图中有 100 个柱。
这是一个细粒度的分布,但它可能并不是那么有用。在考试成绩的情况下,你很幸运,因为已经有等级符号形式的“箱”。所以你可以安排你的垃圾箱与那些相吻合。但是,对于其他类型的数据,您必须发明 bin 范围。
花一些时间考虑您希望如何将分数划分到 bin 中,以及如果您决定特定的“bin 宽度”,直方图是否会描绘出您正在寻找的画面。
您还可以选择将其留给Excel中的自动功能,它将尝试确定最适合您的数据的 bin 宽度。在Excel 中(Excel),您还可以指定 bin 的数量,其中包括可选的所谓的溢出和下溢 bin。这些捕获超过和低于指定值的所有分数。
在Excel中创建直方图(Histogram):一步一步
创建直方图只需点击几下。我们在这里使用的是最新版本的Microsoft 365,但从 2016 开始的任何版本的Office都将以相同的方式工作。
创建直方图(Create the Histogram)
- 假设您已输入数据集的所有值,请选择应包含在 histogram 中的所有值(select all the values that should be included in the histogram)。
- 接下来,切换到插入选项卡(Insert tab)。
- 现在,在图表部分(chart section)下,选择看起来像直方图/条形图的图片。
- 从弹出菜单中,选择histogram。
自定义水平轴(Customize the Horizontal Axis)
现在您的直方图在工作表中,但它可能看起来不像您想要的那样。所以接下来,我们要自定义横轴:
- 右键单击水平轴(horizontal axis)。
- 选择格式轴(Format axis)。
格式轴窗格现在将打开。这里有许多重要的选项可用于调整直方图,使其看起来完全符合您的需要。
在Axis Options下,您可以自定义我们之前讨论过的 bin。这里最重要的两个设置是bin 宽度(bin width)和bin数量(number of bins)。这些选项是相互排斥的。如果您以数字指定 bin 宽度,则 bin 的数量将自动更改,反之亦然。您也可以在此处选择激活溢出和下溢箱。
从歇斯底里图到直方图
希望您现在可以轻松制作直方图,但如果您需要复习基本的Excel概念,请尝试阅读Microsoft Excel 基础教程 - 学习如何使用 Excel(Microsoft Excel Basics Tutorial – Learning How to Use Excel)
How to Make a Histogram in Excel
A histogram is a type of сhart you can generate from data in Excel. It makes it еasy to summarize thе frequenсy of particular vаlues іn your dataset. Excel makes it simple to create a histogram, asѕuming that a histogram is actually what you need!
What Is a Histogram?
A histogram is a type of chart that uses vertical bars to summarize ranges of data. While it may look like a bar chart, there are significant differences. Bar charts show the differences among variables, whereas histograms are generally used to show the differences among variables in terms of another variable.
To illustrate, a histogram may be used to show us how common ranges of IQ scores are. Each bar represents a “bin” or range of scores. So something like 0-10,11-20, etc.
The vertical Y-axis shows us how many measurements of that variable fall within each bin range. So if you have 100 people write an IQ test, every person whose score falls within a particular bin is counted towards the frequency score of that bin.
With a bar chart, you might want to compare something like average IQ scores between countries. In this case, each bar might represent a country and the vertical Y-axis would represent the average IQ of that country.
When Should You Use a Histogram?
HIstograms are a visualization of frequency distribution. It can help you see, at a glance, what sort of distribution your data has. For example, the “Normal Distribution” has the distinctive bell-curve look. A bimodal distribution will have two bumps. You can also see if score frequencies are skewed one way or another.
Of course, if you really want to determine whether your frequency distribution is normal or not, you’d run a normality test in Excel on your data. Those tests still use histograms as a basis though and creating and observing a histogram is a crucial first step in showing you roughly what sort of distribution you may be dealing with.
What You Need To Make a Histogram
In order to make a histogram, you need a few things:
- A set of measurements for a single variable.
- Defined “bins” of value ranges.
The first requirement is fairly straightforward. For example, if you have the weights of a group of people, you’d have each measured weight recorded in your dataset. Be careful not to mix the data from groups you don’t want to measure together into one histogram. For example, if you only wanted to look at the weight distribution of a certain age group or gender, you should only include data for that group.
If you wanted to compare the frequency distributions between two groups on a single variable, you’d need multiple histograms. One for each population group.
All About Bins
The next requirement is the trickiest. You need to decide on the “bins” that your frequency counts will be sorted into. The problem is that these may be arbitrary. If you’re going to look at the frequency of scores between 0 and 100, you could have 100 bins, one for each possible score. However, that means 100 bars in your histogram.
That’s a finely-grained distribution, but it’s probably not all that useful. In the case of test scores, you’re in luck since there are already “bins” in the form of grade symbols. So you could arrange your bins to coincide with those. However, for other types of data you have to invent the bin ranges.
Spend some time considering how you’d like to divide scores into bins and whether the histogram will paint the picture you’re looking for if you decide on a particular “bin width”.
You can also choose to leave it to an automatic function in Excel, where it will try to decide on a bin width that’s best suited to your data. In Excel, you can also specify the number of bins, which includes optional so-called overflow- and underflow- bins. These capture all scores over and under a specified value.
Creating a Histogram in Excel: Step-by-Step
Creating a histogram takes just a few clicks. We’re using the latest version of Microsoft 365 here, but any version of Office starting with 2016 will work the same way.
Create the Histogram
- Assuming you’ve entered all the values for your dataset, select all the values that should be included in the histogram.
- Next, switch to the Insert tab.
- Now, under the chart section, select on the picture that looks like a histogram/bar chart.
- From the popup menu, select histogram.
Customize the Horizontal Axis
Now your histogram is in the sheet, but it probably doesn’t look the way you want it to. So next, we’re going to customize the horizontal axis:
- Right-click the horizontal axis.
- Choose Format axis.
The format axis pane will now be open. There are a number of important options here that you can use to tune your histogram so that it looks exactly like you need it to.
Under Axis Options, you can customize the bins we discussed earlier. The two most important settings here are bin width and the number of bins. These options are mutually exclusive. If you specify a bin width in numbers, the number of bins will change automatically and vice versa. You can choose to activate overflow and underflow bins here as well.
From Hysteriagram to Histogram
Hopefully you can now make a histogram easily, but if you need to review basic Excel concepts, try reading Microsoft Excel Basics Tutorial – Learning How to Use Excel