Tableau 剧本 - 步骤线
介绍
Tableau 是当今最流行的交互式数据可视化工具。它提供了各种各样的图表,可让您轻松有效地探索数据。本系列指南 - Tableau Playbook - 将介绍 Tableau 中各种常见的图表。本指南将重点介绍步骤线。
在本指南中,我们将重点介绍步骤线的概念和基本流程:
我们将从一个示例图表开始,介绍它的概念和特点。
通过分析一个真实的数据集:Rossmann Store Sales,我们将学习如何逐步构建阶梯线图。同时,我们将从 Tableau 可视化中得出一些结论。
我们将介绍相关图表并对折线图的变化进行比较。
入门
例子
这是Tim Ngwena 在 Tableautim 中创建的迷你图示例。在这个仪表板中,他使用了各种视觉元素来展示唐纳德·特朗普从 2013 年到 2016 年的推文。在这个仪表板的顶部,他构建了一组阶梯线来说明特朗普推文的每日频率。与普通的折线图不同,阶梯线强调了频率随时间的变化幅度。
概念与特征
阶梯线和跳跃线均源自折线图。折线图是显示数据随时间变化趋势的好方法,但如果数据仅在离散时间点采样,则在这些点之间画一条直线可能会产生误导。与用直线连接数据的普通折线图不同,阶梯线和跳跃线通过修改路径来突出显示数据点之间的显著变化。
根据Tableau 官方视频,阶梯线绘制数值直到其发生变化,然后以 90 度角向上跃升至下一个值,看起来像楼梯的台阶。这对于强调变化的幅度非常有用。
相比之下,跳跃线的作用类似,但不绘制连接值的垂直线,而是从一个值跳转到另一个值。这对于强调值在更改之前的持续时间很有用。
因此,阶梯线和跳跃线之间的主要区别在于连接方式。阶梯线像“楼梯台阶”一样连接数据点,而跳跃线中没有任何连接点。
数据通常不会以渐进和连续的方式变化,而是从一个离散值跳到另一个离散值。因此,它们有助于处理数据中不一致的变化率。
最后说说缺点吧,和折线图一样,它们不宜用来连接分类数据,而且学习成本也比较高,阶梯线和跳跃线不是标准的图表类型,不是每个人都懂。
数据集
在本指南中,我们使用来自本次 Kaggle 竞赛的Rossmann Store Sales 数据集。感谢Rossmann和Kaggle提供此数据集。
该数据集包含 Rossmann 856 家商店的三年销售数据。商店销售受多种因素影响,包括促销、竞争、学校和国家假期、季节性和地点。
我已经完成了该数据集的数据整理和特征工程。您可以从 Github 下载我的版本,以进行更好的探索性数据分析。
阶梯线
根据之前的折线图分析,12 月是一年中销售额最高的月份。在此示例中,我们将进一步分析商店样本 12 月的每日销售额。
由于阶梯线用于突出变化的不规则性,阶梯线图将注意力从趋势中吸引出来,以显示没有变化的时期,并强调每次变化的确切时间及其幅度。因此,阶梯线图是显示这些数据的更好方法:
我们先建立一个连续折线图:
- 将“日期”拖到列架中。
- 右键单击列架上的“YEAR(日期)” ,并将类型从连续日期值更改为天。
- 将“销售额”拖到“行”栏中。
- 因为我们只想显示2013年12月的销售额,所以我们需要过滤“日期”。将“日期”拖到过滤卡中。
- 当输入日期类型时,会弹出过滤字段[日期]对话框。在离散日期部分中选择月份/年份,然后按下一步按钮。
- 在过滤器列表中仅选择“2013 年 12 月”。
- 我们选择商店 49 作为样本商店。因此我们需要将“商店”拖到筛选卡中。
- 在“商店”的过滤列表中仅选择“49”。
Now we convert the line type to step line. Expand Path shelf and choose Step from Line Type.
Add some well-formatted labels to enhance the representation ability.
- Hold down the Control key (Command key in mac) which means make a copy and drag "SUM(Sales)" into Marks - Label.
- We are going to highlight the extreme value of the step lines. So we expand Marks - Label option pane and choose Min/Max in Marks to Label.
- Expand Font pane and choose Match Mark Color.
- Format the labels into currency form. Right-click on "SUM(Sales)" and click Format... -> Expand Numbers in Default Option -> Choose Currency (Custom) and set Decimal places as 0.
In the last step, let's polish this chart:
- Edit the Title to "Daily Sales of Store 49 | December 2013".
- Remove the grid lines and make our data present cleaner: Navigate to Format -> Lines... and set Grid Lines as None in Rows.
- Remove the date axis title "Day of Date [December 2013]" in Edit Axis...
Analysis:
With the help of step lines, we can clearly see the magnitude of the daily sales change. As the highest month of a year, the top sales days are concentrated before Christmas, specifically from December 17th to December 23rd. We can speculate that the main reason may be the preparation for Christmas and promotional activities.
By flagging the extreme points, it provides a way to see the range and point values conveniently.
Line Charts are often used to show trends or continuous changes in the data over a period of time. By enhancing visualizations, there are some line chart variations applied to different scenarios:
- Use Dual Axis Line Chart when you need to combine two line charts.
- Choose Area Chart when you also need to pay attention to the magnitude or part-to-whole relation.
- When your only concerns are the general shape of the variation and making a comparison in some charts, Sparklines is the best practice.
- When you want to emphasize the magnitude of the change, Step Lines is a good choice.
- When you want to emphasize the duration of a value before it changes, you may consider Jump Lines.
Here is a Dashboard of these line charts for comparison:
Conclusion
希望你喜欢。如果您有任何问题,欢迎通过 recnac@foxmail.com 与我联系。
免责声明:本内容来源于第三方作者授权、网友推荐或互联网整理,旨在为广大用户提供学习与参考之用。所有文本和图片版权归原创网站或作者本人所有,其观点并不代表本站立场。如有任何版权侵犯或转载不当之情况,请与我们取得联系,我们将尽快进行相关处理与修改。感谢您的理解与支持!
请先 登录后发表评论 ~