棒棒糖 宏_棒棒糖图表

棒棒糖 宏

AKA: lollipop plot

又名:棒棒糖情节

WHY: a lollipop chart (LC) is a handy variation of a bar chart where the bar is replaced with a line and a dot at the end. Just like bar graphs, lollipop plots are used to make comparisons between different items or categories. They are also used for ranking or for showing trends over time. We compare only one numerical variable per item or category. They are not suitable for relationships, distribution, or composition analysis.

为什么 :棒棒糖图(LC)是条形图的一种方便的变体,其中条形图的末尾用线和点代替。 就像条形图一样,棒棒糖图用于在不同项目或类别之间进行比较 。 它们还用于排名或显示一段时间内的趋势 。 每个项目或类别我们仅比较一个数值变量。 它们不适用于关系,分布或组成分析。

LCs are preferred to bar charts when you have to display a large number of similar high values. In that case with a standard bar plot, you may get a cluttered chart and experience an optical effect called a Moiré pattern (#1). Fig. 1 shows a bar chart on the left and a lollipop chart on the right side. Both are based on the same data but it is evident that the minimalist alternative of the lollipop results in a more attractive and clear visualization.

当您必须显示大量相似的高值时,LC优于条形图。 在这种情况下,使用标准条形图,您可能会得到混乱的图表并体验到一种称为莫尔图案 (#1)的光学效果。 图1在左侧显示条形图,在右侧显示棒棒糖图。 两者都是基于相同的数据,但是很明显,棒棒糖的极简主义替代方案可以使视觉效果更具吸引力和清晰感。

Image for post
Fig. 1: comparison between a bar chart and a lollipop graph.
图1:条形图和棒棒糖图之间的比较。

The Moiré effect is a visual perception that occurs when viewing a set of lines or bars that is superimposed on another set of lines or bars, where the sets differ in relative size, angle, or spacing. Moiré patterns are those dark bands you see when looking through layered fences or when taking a picture of a TV or a computer screen. Even though the Moiré effect can produce interesting and beautiful geometric patterns, they should be avoided in data visualization tasks so as not to confuse the audience.

莫尔效应是一种视觉效果,当查看重叠在另一组线或条上的一组线或条时,该组线或条的相对大小,角度或间距不同。 莫尔条纹是通过分层的栅栏或电视机或计算机屏幕拍照时看到的暗带。 尽管莫尔效应可以产生有趣而美丽的几何图案,但在数据可视化任务中应避免使用它们,以免引起听众的困惑。

HOW: lollipop charts are two-dimensional with two axes: one axis shows categories or a time series, the other axis shows numerical values. Those numerical values are indicated by the position of the dot at the end of the line. A vertically oriented LC displays the categorical variable on the y-axis whilst a horizontally oriented LC displays it on the x-axis. Figure 2 shows a schematic diagram of a horizontal LC where the dots at the end of the thin lines indicate the numerical value for each category. With Matplotlib, you must use the stem function to draw a horizontal lollipop. The stem function plots vertical lines from a baseline to the y-coordinate and places a marker at the top (#2).

HOW:棒棒糖图表是带有两个轴的二维图:一个轴显示类别或时间序列,另一个轴显示数值。 这些数值由点在行尾的位置表示。 垂直方向的LC在y轴上显示类别变量,而水平方向的LC在x轴上显示类别变量。 图2显示了水平LC的示意图,其中细线末端的点表示每个类别的数值。 使用Matplotlib时 ,必须使用主干功能绘制水平棒棒糖。 功能绘制从基线到y坐标的垂直线,并将标记放在顶部(#2)。

Image for post
Fig. 2: schematic diagram of a lollipop chart.
图2:棒棒糖图的示意图。

LCs are a nice alternative for rankings. The standard procedure is to arrange the categories in decreasing order and represent them vertically. With Matplotlib, you must use in combination the functions hlines and plot to draw a vertical lollipop. hlines draw horizontal lines at each y from the scalars xmin to xmax (#3). There are several possible markers for the function plot but we suggest using the classic circle symbol, as shown in the figures of this article.

LC是排名的不错选择。 标准程序是按降序排列类别并垂直表示它们。 使用Matplotlib时 ,必须结合使用hlinesplot功能绘制垂直棒棒糖。 hlines在标量xminxmax (#3)的每个y处绘制水平线。 该功能可能有几种标记,但是我们建议使用经典的圆形符号,如本文中的图所示。

Image for post
Fig. 3: a vertical and ordered lollipop chart.
图3:垂直且有序的棒棒糖图。

You must always start the numerical axis at 0: if the lines are truncated, the actual value is not properly reflected. Remember that our sight is very sensitive to differences in length when trying to compare data. We inevitably distort the visual if we modify the baseline. If one of the variables is time (years, months, days, hours), always set it on the horizontal axis. Time always runs from left to right and never from top to bottom.

您必须始终将数字轴从0开始:如果直线被截断,则不能正确反映实际值。 请记住,在尝试比较数据时,我们的视线对长度的差异非常敏感。 如果我们修改基线,不可避免地会扭曲视觉效果。 如果变量之一是时间(年,月,日,小时),请始终在水平轴上进行设置。 时间总是从左到右,而不是从上到下。

LCs are equivalent to bar charts, but this equivalence is only valid for standard bar charts; do not try to extend it to Stacked, Clustered, or Overlapping Bar Graphs (#4, #5).

LC等效于条形图,但是这种等效仅对标准条形图有效; 不要尝试将其扩展到堆积,聚集或重叠的条形图(#4,#5)。

LCs were the subject of an interesting debate, both on a theoretical and conceptual level, between two data visualization heavyweights: Stephen Few and Albert Cairo (#6). Few through the sarcastic title “Lollipop Charts: “Who Loves You, Baby?” claimed that “LCs were inspired by the same thing that has inspired so many silly graphs: a desire for cuteness and novelty”. He added that the main problem with LCs was that: “The center of the circle at the end of the lollipop marks the value, but the location of the center is difficult to judge, making it imprecise compared to the straight edge of a bar, and half of the circle extends beyond the value that it represents, making it inaccurate”.

在两个数据可视化重量级人物: Stephen FewAlbert Cairo (#6)之间,LC在理论和概念上都引起了有趣的争论。 讽刺的标题“棒棒糖排行榜:“谁爱你,宝贝?” 声称“ LC的灵感来自启发了许多愚蠢图表的同一事物:对可爱和新颖的渴望”。 他补充说,液相色谱的主要问题是:“棒棒糖末端的圆心标记了该值,但是中心位置很难判断,与条形的直边相比,它不精确,圆的一半超出了它所代表的值,因此不准确。”

For his part, Cairo came out in defense of the charts indicating that: “I believe that lollipops have their uses. Bar graphs with more than, say, 8 or 9 bars, often look busy and clunky. Lollipop graphs may solve that problem by increasing the amount of white space in between bars significantly.” He proposed as a solution to reduce the size of the circles or even mark the numerical value with the upper point of the circle instead.

就开罗而言,他捍卫了图表,表明:“我相信棒棒糖有其用途。 条形图超过8个或9个,通常看起来很忙且笨拙。 棒棒糖图可以通过大大增加条形图之间的空白空间来解决该问题。” 他提出了一种解决方案,以减小圆的大小,甚至用圆的上点标记数值。

Eli Holder in a very interesting article published in Nightingale (#7) with the title: “Settling the Debate: Bars vs. Lollipops (vs. Dot Plots)” described an experiment to shed some light about: “How do lollipop charts affect readers’ comprehension? How much of our epistemic responsibility are we sacrificing for a playful aesthetic?” Finally, he concluded that the results of the experiments show no significant differences between Bar and Lollipop graphs and they led to roughly equal accuracy and equal response times. In the end, LCs provide a nice minimalistic visualization of the data and they should be used exactly in the same situation than a bar graph.

Eli Holder在Nightingale(#7)上发表的一篇非常有趣的文章中,标题为:“解决辩论:酒吧与棒棒糖(vs.点图)”,该实验揭示了一些有关以下内容的实验:“棒棒糖图表如何影响读者理解力? 为了一种有趣的审美观,我们牺牲了多少认知责任?” 最后,他得出结论,实验结果表明Bar和Lollipop图之间没有显着差异,并且导致大致相等的精度和相等的响应时间。 最后,LC提供了很好的数据的简约可视化,应该在与条形图完全相同的情况下使用它们。

棒棒糖讲故事 (Storytelling with Lollipops)

1.- Fuel Consumption with the mtcars dataset: Human activities have increased carbon dioxide emissions (CO2) and other greenhouse gases (GHC), driving up temperatures. Most man-made emissions of CO2 come from burning fossil fuels. GHG emissions from transportation account for about 28 percent of total U.S. greenhouse gas emissions, making it the largest contributor of the USA (#8). The United States Environmental Protection Agency had developed a national program for GHG and fuel economy standards for light-duty vehicles (passenger cars and trucks).

1.- mtcars数据集的燃料消耗 :人类活动增加了二氧化碳排放量(CO2)和其他温室气体(GHC),从而提高了温度。 大多数人为排放的二氧化碳来自燃烧化石燃料。 运输产生的温室气体排放量约占美国温室气体总排放量的28%,是美国的最大贡献者(排名第8)。 美国环境保护署已经制定了一项针对轻型车辆(客车和卡车)的温室气体和燃油经济性标准的国家计划。

Previous studies on fuel consumption were based on Motor Trend Car Road Tests through the mtcars dataset. Data were extracted from the 1974 Motor Trend US magazine, and comprises fuel consumption and 10 aspects of automobile design and performance for 32 automobiles (1973–74 models). The following LC indicates miles traveled per gallon consumed for 32 car brands. Blue dash-dotted lines on the top correspond to those vehicles whose consumption was lower than the average (20.09 mpg) while the red dash-dotted lines correspond to those vehicles whose consumption was higher than the average. Clearly, a lollipop chart is better than a bar graph for comparing such a large number of different categories.

先前的油耗研究基于mtcars数据集的Motor Trend汽车路 。 数据摘自1974年《美国汽车趋势》杂志,其中包括油耗以及32辆汽车(1973–74年型号)的汽车设计和性能的10个方面。 以下LC表示32个汽车品牌每加仑消耗的行驶里程。 顶部的蓝色虚线表示那些消耗量低于平均值(20.09 mpg)的车辆,而红色虚线表示那些消耗量高于平均值的车辆。 显然,棒棒糖图表比条形图更好地比较了如此众多的不同类别。

Image for post
mtcars dataset.mtcars数据集的每加仑行驶的英里数。

2.Argentina´s Government Budget: A Government Budget is an itemized accounting of the payments received by government (taxes and other fees) and the payments made by government (purchases and transfer payments). A budget deficit occurs when a government spends more money than it takes in. The opposite of a budget deficit is a budget surplus.

2. 阿根廷政府预算 :政府预算是对政府收到的付款(税款和其他费用)和政府付款(购买和转移付款)的逐项核算。 当政府的支出超过收入时,就会出现预算赤字。与预算赤字相反的是预算盈余。

Argentina grapples with one of the world’s highest inflation rates due to its recurrent government budget deficit. The next figure shows the country´s monthly budget deficit for the 2012–2018 period. Now, a lollipop chart allows us to follow the budget pattern over an extended period of time in an aesthetically pleasing way. As stated above, time runs from left to right on the horizontal axis.

由于政府经常性预算赤字,阿根廷努力应对世界上通货膨胀率最高的国家之一。 下图显示了该国2012-2018年期间的每月预算赤字。 现在,棒棒糖图表可让我们以美观的方式在很长一段时间内遵循预算模式。 如上所述,时间在水平轴上从左到右。

Image for post
Fig. 5: Argentina monthly budget deficit.
图5:阿根廷每月预算赤字。

IN SUMMARY: used exactly in the same situation than a standard bar chart, lollipop charts encode numerical values in the same way: the length of the lines and the location of the dots at the end of the lines are equivalent to the length or height of horizontal or vertical rectangular bars. Lollipop Charts are preferred to bar charts when you are dealing with a large number of similar numerical values.

总结:在与标准条形图完全相同的情况下使用,棒棒糖图以相同的方式对数值进行编码:线条的长度和线条末端的点的位置等于线条的长度或高度水平或垂直矩形条。 当您处理大量相似的数值时,棒棒糖图表优于条形图。

If you find this article of interest, please read my previous:

如果您发现这篇文章感兴趣,请阅读我以前的文章:

“Bubble Charts, Why & How, Storytelling with Bubbles”

“气泡图,为什么和如何,用气泡讲故事”

“Parallel Coordinates Plots, Why & How, Storytelling with Parallels”

“平行坐标图,为什么和如何,平行讲故事”

#1: https://en.wikipedia.org/wiki/Moir%C3%A9_pattern

#1: https : //en.wikipedia.org/wiki/Moir%C3%A9_pattern

#2: https://matplotlib.org/3.1.1/gallery/lines_bars_and_markers/stem_plot.html

#2: https : //matplotlib.org/3.1.1/gallery/lines_bars_and_markers/stem_plot.html

#3: https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.hlines.html

#3: https : //matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.hlines.html

#4: Darío Weitz, “Stacked Bar Graphs, Why & How, Storytelling & Warnings”https://towardsdatascience.com/stacked-bar-graphs-why-how-f1b68a7454b7

#4:DaríoWeitz,“堆叠条形图,为什么和如何操作,讲故事和警告” https://towardsdatascience.com/stacked-bar-graphs-why-how-f1b68a7454b7

#5: Darío Weitz, “Clustered & Overlapped Bar Charts, Why & How”https://towardsdatascience.com/clustered-overlapped-bar-charts-94f1db93778e

#5:DaríoWeitz,“成组的和重叠的条形图,为什么和如何做”, https://towardsdatascience.com/clustered-overlapped-bar-charts-94f1db93778e

#6: Stephen Few, “Lollipop Charts: “Who Loves You, Baby?https://www.perceptualedge.com/blog/?p=2642

#6:Stephen Few,“棒棒糖排行榜:”谁爱你,宝贝? https://www.perceptualedge.com/blog/?p=2642

#7: Eli Holder, https://medium.com/nightingale/bar-graphs-vs-lollipop-charts-vs-dot-plots-experiment-ba0bd8aad5d6

#7:Eli Holder, https ://medium.com/nightingale/bar-graphs-vs-lollipop-charts-vs-dot-plots-experiment-ba0bd8aad5d6

#8: https://www.epa.gov/transportation-air-pollution-and-climate-change/carbon-pollution-transportation

#8: https : //www.epa.gov/transportation-air-pollution-and-climate-change/carbon-pollution-transportation

翻译自: https://towardsdatascience.com/lollipop-charts-2f748b90f6f0

棒棒糖 宏

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/391066.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

ubuntu上如何安装tomcat

1. 在官网下载linux里面的tomcat 2. 放到DownLoads下面--把tomcat的压缩包放到DownLoads3. sudo mkdir /usr/local/tomcat/ -在usr/local/路径下新建一个tomcat的文件夹4 sudo tar zxvf tomcat。。。。tar.gz -C /usr/local/tomcat/---把解压后的tomcat放到usr/local/下的tomca…

ZooKeeper3.4.5-最基本API开发

2019独角兽企业重金招聘Python工程师标准>>> package cn.itcast.bigdata.zk;import java.io.IOException; import java.util.List;import org.apache.zookeeper.CreateMode; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.WatchedEven…

nlp自然语言处理_不要被NLP Research淹没

nlp自然语言处理自然语言处理 (Natural Language Processing) 到底是怎么回事? (What is going on?) NLP is the new Computer VisionNLP是新的计算机视觉 With enormous amount go textual datasets available; giants like Google, Microsoft, Facebook etc have…

opencv 随笔

装环境好累,python3.6,opencv3.4 好不容易装好了,结果 addweight的时候总是报错 The operation is neither array op array (where arrays have the same size and the same number of channels), nor array op scalar, nor scalar op array …

中小型研发团队架构实践三要点(转自原携程架构师张辉清)

如果你正好处在中小型研发团队…… 中小型研发团队很多,而社区在中小型研发团队架构实践方面的探讨却很少。中小型研发团队特别是 50 至 200 人的研发团队,在早期的业务探索阶段,更多关注业务逻辑,快速迭代以验证商业模式&#xf…

时间序列预测 预测时间段_应用时间序列预测:美国住宅

时间序列预测 预测时间段1.简介 (1. Introduction) During these COVID19 months housing sector is rebounding rapidly after a downtime since the early months of the year. New residential house construction was down to about 1 million in April. As of July 1.5 mi…

zabbix之web监控

Web monitoring(web监控)是用来监控Web程序的,可以监控到Web程序的下载速度,返回码以及响应时间,还支持把一组连续的Web动作作为一个整体进行监控。 1.Web监控的原理 Web监控即对HTTP服务的监控,模拟用户去访问网站,对…

经验主义 保守主义_为什么我们需要行动主义-始终如此。

经验主义 保守主义It’s been almost three months since George Floyd was murdered and the mass protests. Three months since the nationwide protests, looting and riots across America.距离乔治弗洛伊德(George Floyd)被谋杀和大规模抗议活动已经快三个月了。 全国抗议…

redis介绍以及安装

一、redis介绍 redis是一个key-value存储系统。和Memcached类似,它支持存储的values类型相对更多,包括字符串、列表、哈希散列表、集合,有序集合。 这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且…

python机器学习预测_使用Python和机器学习预测未来的股市趋势

python机器学习预测Note from Towards Data Science’s editors: While we allow independent authors to publish articles in accordance with our rules and guidelines, we do not endorse each author’s contribution. You should not rely on an author’s works withou…

Python数据结构之四——set(集合)

Python版本:3.6.2 操作系统:Windows 作者:SmallWZQ 经过几天的回顾和学习,我终于把Python 3.x中的基础知识介绍好啦。下面将要继续什么呢?让我想想先~~~嗯,还是先整理一下近期有关Python基础知识的随笔吧…

knn 机器学习_机器学习:通过预测意大利葡萄酒的品种来观察KNN的工作方式

knn 机器学习Introduction介绍 For this article, I’d like to introduce you to KNN with a practical example.对于本文,我想通过一个实际的例子向您介绍KNN。 I will consider one of my project that you can find in my GitHub profile. For this project, …

python 实现分步累加_Python网页爬取分步指南

python 实现分步累加As data scientists, we are always on the look for new data and information to analyze and manipulate. One of the main approaches to find data right now is scraping the web for a particular inquiry.作为数据科学家,我们一直在寻找…

关于双黑洞和引力波,LIGO科学家回答了这7个你可能会关心的问题

引力波的成功探测,就像双黑洞的碰撞一样,一石激起千层浪。 关于双黑洞和引力波,LIGO科学家回答了这7个你可能会关心的问题 最近,引力波的成功探测,就像双黑洞的碰撞一样,一石激起千层浪。 大家兴奋之余&am…

用于MLOps的MLflow简介第1部分:Anaconda环境

在这三部分的博客中跟随了演示之后,您将能够: (After following along with the demos in this three part blog you will be able to:) Understand how you and your Data Science teams can improve your MLOps practices using MLflow 了解您和您的数…

pymc3 贝叶斯线性回归_使用PyMC3估计的贝叶斯推理能力

pymc3 贝叶斯线性回归内部AI (Inside AI) If you’ve steered clear of Bayesian regression because of its complexity, this article shows how to apply simple MCMC Bayesian Inference to linear data with outliers in Python, using linear regression and Gaussian ra…

mongodb分布式集群搭建手记

一、架构简介 目标 单机搭建mongodb分布式集群(副本集 分片集群),演示mongodb分布式集群的安装部署、简单操作。 说明 在同一个vm启动由两个分片组成的分布式集群,每个分片都是一个PSS(Primary-Secondary-Secondary)模式的数据副本集; Confi…

python16_day37【爬虫2】

一、异步非阻塞 1.自定义异步非阻塞 1 import socket2 import select3 4 class Request(object):5 def __init__(self,sock,func,url):6 self.sock sock7 self.func func8 self.url url9 10 def fileno(self): 11 return self.soc…

朴素贝叶斯实现分类_关于朴素贝叶斯分类及其实现的简短教程

朴素贝叶斯实现分类Naive Bayes classification is one of the most simple and popular algorithms in data mining or machine learning (Listed in the top 10 popular algorithms by CRC Press Reference [1]). The basic idea of the Naive Bayes classification is very …

2019年度年中回顾总结_我的2019年回顾和我的2020年目标(包括数量和收入)

2019年度年中回顾总结In this post were going to take a look at how 2019 was for me (mostly professionally) and were also going to set some goals for 2020! 🤩 在这篇文章中,我们将了解2019年对我来说(主要是职业)如何,我们还将为20…