数据可视化图表类型
When working on any data science project, one of the essential steps to explore and interpret your results is to visualize your data. At the beginning of the project, visualizing your data helps you understand it better, find patterns and trends.
在进行任何数据科学项目时,探索和解释结果的基本步骤之一就是可视化数据。 在项目开始时,可视化数据有助于您更好地理解数据,查找模式和趋势。
At the end of the project, after you’ve done your analysis and applied different machine learning models, data visualization will help you communicate your results more efficiently.
在项目结束时,完成分析并应用了不同的机器学习模型之后,数据可视化将帮助您更有效地传达结果。
Humans are visual creatures by nature; things make sense to us when it’s represented in an easy to understand visualization. It’s way easier to interpret a bar chart than it is to look at massive amounts of numbers in a spreadsheet.
人类天生就是视觉生物。 当它以易于理解的可视化形式呈现时,对我们来说意义非凡。 解释条形图比查看电子表格中的大量数字要容易得多。
Efficient data visualization can make or break your project. If you put tons of effort into analyzing and modeling your data, but you ended up using the wrong chart type to present your results, your audience will not grasp the effort you put in or how to use these results.
高效的数据可视化可以创建或破坏您的项目。 如果您花费大量精力来分析和建模数据,但最终使用了错误的图表类型来显示结果,那么您的听众将无法理解您所付出的努力或如何使用这些结果。
There are many chart types, so many, the process of choosing the correct one can be overwhelming and confusing. This article will — hopefully — give you a simple and straightforward approach to selecting the best chart type that represents your data perfectly and communicate it most efficiently.
图表类型很多,选择正确的图表的过程可能会令人不知所措。 希望本文将为您提供一种简单明了的方法,以选择能够完美代表您的数据并最有效地进行通信的最佳图表类型。
如何开始? (How to start?)
Before you start looking at chart types, you need to ask yourself 5 critical questions about your data. These questions will help you understand your data better and hence, choose the perfect chart type to represent it.
在开始查看图表类型之前,您需要问自己5个关于数据的关键问题。 这些问题将帮助您更好地理解数据,因此,选择理想的图表类型来表示它。
№1。 您的数据试图传达什么故事? (№1. What’s the story your data is trying to deliver?)
Data is just a story told in numbers.
数据只是一个用数字讲述的故事。
So, the first thing you need to know about your data is, what story is it trying to deliver? Why was this data collected, and how?
因此,您需要了解的关于数据的第一件事是,它试图传达什么故事? 为什么收集这些数据,以及如何收集?
Is your data collected to find trends? To compare different options? Is it showing some distribution? Or is used to observe the relationship between different value sets?
是否收集您的数据以查找趋势? 比较不同的选择? 它显示出一些分布吗? 还是用来观察不同值集之间的关系?
Understanding the origin story of your data and knowing what it’s trying to deliver will make choosing a chart type a much easier task for you.
了解数据的起源故事并了解其要传递的内容将使选择图表类型对您而言变得容易得多。
№2。 您将向谁展示结果? (№2. Who will you present your results to?)
Once you figured out the story behind your data, next, you need to know who you will be presenting your results for. If you’re analyzing stock market trends and you will present your findings to some businessmen, you might use a different chart type than if you were representing your finding for people getting started with the stock market.
弄清数据背后的故事后,接下来,您需要知道将向谁显示结果。 如果要分析股票市场趋势,并将发现的结果呈现给某些商人,则使用的图表类型可能与代表股票市场入门者的发现不同。
The whole purpose of using data visualization is to make data communication more efficient.
使用数据可视化的全部目的是使数据通信更加有效。
For that reason, you need to know your audience so you can choose the best chart type to use when representing your data to them.
因此,您需要了解您的受众,以便您选择向他们展示数据时要使用的最佳图表类型。
№3。 您的数据有多大? (№3. How big is your data?)
The size of your data will significantly affect the type of chart you will use. Some types of charts are meant to be used with massive datasets, while others are perfect for big data.
数据的大小将严重影响您将使用的图表类型。 某些类型的图表打算与海量数据集一起使用,而另一些则非常适合大数据。
For example, piecharts work best with a small number of datasets; however, if you’re using a significant amount of datasets, using a scatter plot will make more sense.
例如,饼图最适合少数数据集。 但是,如果您使用大量数据集,则使用散点图会更有意义。
You need to select a chart type that fits the size of your data best and represents it clearly without cluttering.
您需要选择最适合您数据大小的图表类型,并清楚地表示它,而不会造成混乱。
№4。 您的数据类型是什么? (№4. What is your data type?)
There are several types of data, describe, continuous, qualitative, or categorial. You can use the kind of data to eliminate some chart types. For example, if you have continuous data, a bar chart may not be the best choice; you may need to go with a line chart instead.
有几种类型的数据,描述的,连续的,定性的或分类的。 您可以使用数据类型来消除某些图表类型。 例如,如果您有连续数据,则条形图可能不是最佳选择。 您可能需要改用折线图。
Similarly, if you have categorical data, then using a bar chart or a pie chart may be a good idea. You probably will not want to use a line chart with categorical data, because by definition, you can’t have continuous categories. The has to be a discrete finite amount of categories.
同样,如果您具有分类数据,则使用条形图或饼图可能是个好主意。 您可能不希望将折线图与分类数据一起使用,因为根据定义,您不能具有连续的类别。 必须是数量有限的类别。
№5。 您的数据的不同元素如何相互关联? (№5. How do the different elements of your data relate to each other?)
Finally, you need to ask yourself how do the different elements of your data relate. Is your data order based on some factor — time, size, type? Doesn’t represent a ranking based on some variable? Or a correlation between different variables?
最后,您需要问问自己,数据的不同元素之间的关系如何。 您的数据顺序是否基于某种因素-时间,大小,类型? 不代表基于某些变量的排名吗? 还是不同变量之间的相关性?
Is your data a time-series — data that changes over time? Or is it more of a distribution?
您的数据是否为时间序列-随时间变化的数据? 还是更多的分布?
The relationship between the values within your dataset may decide on what chart type to use a bit more straightforward.
数据集中值之间的关系可能决定使用哪种图表类型更简单。
排名前7位的二手图表类型 (The top 7 used chart types)
There are more than 40 types of charts out there; some are more commonly used than others because they are easier to build and interpret. Let’s talk about the top 7 used charts type and when to use each of them.
有超过40种图表类型; 有些比其他的更常用,因为它们更易于构建和解释。 让我们谈谈使用率最高的7种图表类型以及何时使用它们。
条形图 (Bar Chart)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/f6794a81b6d01e67aff4f6851e65d24e.png)
When to use:
何时使用:
- Comparing parts of a bigger set of data, highlighting different categories, or showing change over time. 比较大量数据的一部分,突出显示不同的类别,或显示随时间变化。
- Have long categories label — it offers more space. 带有长类别标签-提供更多空间。
- If you want to illustrate both positive and negative values in the dataset. 如果要说明数据集中的正值和负值。
When to avoid:
什么时候避免:
- If you’re using multiple data points. 如果您使用多个数据点。
- If you have many categories, avoid overloading your graph. Your graph shouldn’t have more than 10 bars. 如果类别很多,请避免使图形过载。 您的图表不应超过10条。
饼形图 (Pie Chart)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/699e9125307c10fe7a0e967538a4308a.png)
When to use:
何时使用:
- When you show relative proportions and percentages of a whole dataset. 显示整个数据集的相对比例和百分比时。
- Best used with small datasets — also applies to donut charts. 最好与小型数据集一起使用-也适用于甜甜圈图。
- When comparing the effect of ONE factor on different categories. 比较一个因素对不同类别的影响时。
- If you have up to 6 categories. 如果您有多达6个类别。
- When your data is nomial and not ordinal. 当您的数据是名义数据而不是序数数据时。
When to avoid:
什么时候避免:
- If you have a big dataset. 如果数据集很大。
- If you want to make a precise or absolute comparison between values. 如果要在值之间进行精确或绝对比较。
折线图 (Line Chart)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/a051a55a5992bfea6813e58457bff5f0.png)
When to use:
何时使用:
- If you have a continuous dataset that changes over time. 如果您有一个连续的数据集,该数据集会随着时间而变化。
- If your dataset is too big for a bar chart. 如果您的数据集对于条形图而言太大。
- If you want to display multiple series for the same timeline. 如果要为同一时间线显示多个系列。
- If you want to visualize trends instead of exact values. 如果要可视化趋势而不是精确值。
When to avoid:
什么时候避免:
- Line charts work better with bigger datasets, so, if you have a small one, use a bar chart instead. 折线图可以与较大的数据集更好地配合使用,因此,如果数据集较小,则可以使用条形图。
散点图 (Scatter Plot)
![Image for post](https://miro.medium.com/max/9999/1*ZnDInL7X8lnswfxOr2igaw.png)
When to use:
何时使用:
- To show correlation and clustering in big datasets. 在大型数据集中显示相关性和聚类。
- If your dataset contains points that have a pair of values. 如果您的数据集包含具有一对值的点。
- If the order of points in the dataset is not essential. 如果数据集中的点顺序不是必需的。
When to avoid:
什么时候避免:
- If you have a small dataset. 如果数据集较小。
- If the values in your dataset are not correlated. 如果数据集中的值不相关。
面积图 (Area Chart)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/52d1418fa6d37d9673146e1370e97240.png)
When to use:
何时使用:
- If you want to show part-to-whole relations. 如果要显示零件之间的关系。
- If you want to portray the volume of your data and not just the relation to time. 如果要描绘数据量,而不仅仅是时间关系。
When to avoid:
什么时候避免:
- It can’t be used with discrete data. 不能与离散数据一起使用。
气泡图 (Bubble Chart)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/12d96f6f32b2d821c76f07288c16fcd7.png)
When to use:
何时使用:
- If you want to compare independent values. 如果要比较独立值。
- If you want to show distribution or relation. 如果要显示分布或关系。
When to avoid:
什么时候避免:
- If you have a small dataset. 如果数据集较小。
组合图 (Combined Chart)
![Image for post](https://i-blog.csdnimg.cn/blog_migrate/0c2247b2b1d48289b58e4ae3a20d461d.png)
When to use:
何时使用:
- If you want to compare values with different measurements. 如果要比较具有不同测量值的值。
- If the values are different in range. 如果值的范围不同。
When to avoid:
什么时候避免:
- If you want to display more than 2~3 types of graphs. In that case, it’s better to have separate graphs to make it easier to read and understand. 如果要显示2〜3种以上的图形。 在这种情况下,最好有单独的图形以使其更易于阅读和理解。
图表选择提示 (Chart selection tips)
Whenever you decide to create some data visualization, use these best practices to make it more straightforward and effective.
每当您决定创建一些数据可视化时,都应使用这些最佳实践来使其更加直接和有效。
- If you have categorical data, use a bar chart if you have more than 5 categories or a pie chart otherwise. 如果您具有分类数据,则如果类别超过5个,则使用条形图,否则使用饼图。
- If you have nominal data, use bar charts or histograms if your data is discrete, or line/ area charts if it is continuous. 如果您有名义数据,则如果数据是离散的,则使用条形图或直方图;如果数据是连续的,则使用折线/面积图。
- If you want to show the relationship between values in your dataset, use a scatter plot, bubble chart, or line charts. 如果要显示数据集中值之间的关系,请使用散点图,气泡图或折线图。
- If you want to compare values, use a pie chart — for relative comparison — or bar charts — for precise comparison. 如果要比较值,请使用饼图(用于相对比较)或条形图(用于精确比较)。
- If you want to compare volumes, use an area chart or a bubble chart. 如果要比较体积,请使用面积图或气泡图。
- If you want to show trends and patterns in your data, use a line chart, bar chart, or scatter plot. 如果要显示数据中的趋势和模式,请使用折线图,条形图或散点图。
结论 (Conclusion)
Before you choose what chart type to use, you need to get to know your data better, the story behind it, and your target audience/media. Whenever you try to create a visualization, chose simple colors and fonts.
在选择使用哪种图表类型之前,您需要更好地了解您的数据,其背后的故事以及您的目标受众/媒体。 每当您尝试创建可视化文件时,请选择简单的颜色和字体。
Always aim for simple visualization than complex ones. The goal of visualizing data is to make it easier to understand and read. So, avoid overloading and cluttering your graphs. Having multiple simple graphs is always better than one elaborate graph.
始终致力于简单的可视化而不是复杂的可视化。 可视化数据的目的是使其更易于理解和阅读。 因此,请避免图形过载和混乱。 具有多个简单图总是比一个复杂的图更好。
This article is the first of three-part series on visualization 101. The next articles will address tips for effective data visualization and the different visualization libraries in Python and how to choose the best one based on your data and graph type.
本文是关于可视化101的三部分系列文章的第一篇。接下来的文章将介绍有效的数据可视化技巧以及Python中的各种可视化库,以及如何根据数据和图形类型选择最佳的可视化技巧。
翻译自: https://towardsdatascience.com/data-visualization-101-how-to-choose-a-chart-type-9b8830e558d6
数据可视化图表类型