数据可视化期末报告

Author

221527124叶松林

1 报告要求

  • 期末实验报告由5章节5个图形组成,每个章节需要作一个图形。

  • 每个章节选择作什么图自主选择,作图前补充完整图形标题名称,例如:图形1——多变量条形图。

  • 案例数据自主收集,不同章节可以公用一个数据集。但同学间不允许使用相同数据集。

  • 每个章节的数据集合需要通过datatable 函数展示,并简要解释数据来源和变量意义。

  • 每个输出图形后需要对图形作简要解读,最少需针对图形提出一个观点。

  • 渲染html文件保留代码展示,6月22日前将发布网址提交至共享文档“8、期末报告” 列中。

  • 评分标准:

    • 每章节图形各20分

    • 能有效输出图形和合理解释75%

    • 数据独特性强10%

    • 图形个性化强15%

2 类别数据可视化

2.1 案例数据解释与展示

  • 数据来源国家统计局中国统计年鉴2024,这份”工业生产者购进价格指数”数据(上年=100)是反映中国工业生产领域原材料采购价格变动情况的重要经济指标

  • 核心变量

    1. 年份

      时间维度:1989-2023年(共35年数据)

      数据类型:时间序列标识

    2. 总指数

      反映全部工业生产者购进价格的综合变动情况

    3. 燃料、动力类

      涵盖煤炭、石油、电力等能源产品

    4. 黑色金属材料类

      包括铁矿石、钢材等钢铁行业原材料

    5. 有色金属材料及电线类

      铜、铝等有色金属及其制品

    6. 化工原料类

      各类基础化学原料及制品

    7. 木材及纸浆类

      木材加工和造纸业原材料

    8. 建筑材料及非金属类

      水泥、玻璃等建筑材料

    9. 农副产品类

      农产品加工的工业原料

    10. 纺织原料类

      棉花、化纤等纺织业原材料

library(openxlsx)
library(tidyverse)
library(readxl)
library(plotly)
library(ggcorrplot)
library(stats)
library(forecast)
datatable<-read.xlsx("C:/Users/asus/Desktop/data.xlsx", sheet = "价格指数数据")
datatable
   年份 总指数 燃料、动力类 黑色金属材料类 有色金属材料及电线类 化工原料类
1  1989  126.4        124.7          130.3                127.6      124.4
2  1990  105.6        110.7          103.9                 97.2       95.6
3  1991  109.1        112.9          112.5                101.2       99.8
4  1992  111.0        116.4          114.5                112.4      102.6
5  1993  135.1        136.7          174.1                115.8      114.3
6  1994  118.2        118.0          103.8                110.7      111.7
7  1995  115.3        108.7           98.2                128.3      127.2
8  1996  103.9        110.2           99.3                 92.4       98.0
9  1997  101.3        109.3           97.4                 96.2       97.1
10 1998   95.8         99.1           95.1                 88.3       93.6
11 1999   96.7        100.9           94.7                 98.9       97.6
12 2000  105.1        115.4          100.9                110.3      105.6
13 2001   99.8        100.2          100.5                 95.6       98.4
14 2002   97.7        100.1           98.2                 96.5       97.5
15 2003  104.8        107.4          107.9                105.3      102.9
16 2004  111.4        109.7          120.4                120.1      108.9
17 2005  108.3        115.0          107.5                114.0      108.3
18 2006  106.0        111.9           98.3                130.8      102.1
19 2007  104.4        104.3          105.4                111.6      103.6
20 2008  110.5        120.6          118.4                 98.6      105.2
21 2009   92.1         89.2           86.3                 81.1       91.3
22 2010  109.6        116.3          106.6                122.2      107.0
23 2011  109.1        110.8          109.4                112.1      110.4
24 2012   98.2        100.9           92.9                 94.5       96.1
25 2013   98.0         96.6           95.7                 95.4       97.3
26 2014   97.8         97.1           94.6                 96.1       98.3
27 2015   93.9         88.7           88.4                 92.7       93.7
28 2016   98.0         95.6           97.7                 97.9       97.6
29 2017  108.1        113.0          115.9                115.3      108.4
30 2018  104.1        107.1          106.1                103.9      104.6
31 2019   99.3         98.2          102.3                 97.6       94.8
32 2020   97.7         91.6          100.5                 99.8       92.7
33 2021  111.0        120.5          120.3                120.9      115.1
34 2022  106.1        120.9           96.4                105.4      106.5
35 2023   96.4         94.7           93.8                 99.3       91.7
   木材及纸浆类 建筑材料及非金属类 农副产品类 纺织原料类
1         111.4              122.7      128.9      128.5
2          99.4              115.2      107.8      107.4
3         105.6              101.2      106.8      108.9
4         102.0              118.8      103.4      100.5
5         128.6              140.9      112.2      107.1
6         115.1              114.3      148.3      139.6
7         115.8              102.6      143.1      123.6
8         101.9              102.5      114.7       94.5
9         100.9               99.7      102.0       94.7
10         96.7               98.6       94.5       94.3
11        100.4               98.8       89.8       96.8
12         99.8              101.5       99.9      102.4
13        100.4               98.6      101.2       99.7
14         98.7               98.2       95.7       97.1
15        100.3               99.7      106.7      101.4
16        102.8              105.1      114.2      104.7
17        103.5              103.1      101.7      102.4
18        102.6              101.9      104.3      102.9
19        102.7              103.0      106.1      101.4
20        105.2              109.5      107.5      103.1
21         95.8              101.1       97.0       98.8
22        103.0              103.8      110.4      106.7
23        104.6              108.4      115.6      112.7
24        100.1               99.7      100.2       99.1
25         99.6               98.7      101.6       99.9
26         99.4               99.8       99.4       98.9
27         99.3               95.9       97.7       97.8
28         99.7               97.6      100.1       99.7
29        106.2              108.6      101.5      104.0
30        105.4              110.5       99.6      102.2
31         97.5              104.2      102.8       99.3
32         98.1              100.5      105.4       96.8
33        105.6              105.5      104.4      105.0
34        104.5              103.1      105.1      105.0
35         96.9               94.1       97.8       97.0

2.2 图形1——热力图

cor_matrix <- datatable %>%
  select(-年份) %>%
  cor()
p1 <- ggcorrplot(cor_matrix, 
                hc.order = TRUE, 
                type = "lower",
                lab = TRUE,
                title = "工业生产者购进价格指数相关性分析") +
  theme(plot.title = element_text(hjust = 0.5))
p1

  • 图形解读:热力图揭示燃料动力类与化工原料类的相关系数达0.82,形成明显的红色高相关区域。

    这种强相关性说明石化产业链的价格传导效率极高,化工企业应当将能源价格作为成本预测的领先指标。

3 数据分布可视化

3.1 案例数据解释与展示

datatable
   年份 总指数 燃料、动力类 黑色金属材料类 有色金属材料及电线类 化工原料类
1  1989  126.4        124.7          130.3                127.6      124.4
2  1990  105.6        110.7          103.9                 97.2       95.6
3  1991  109.1        112.9          112.5                101.2       99.8
4  1992  111.0        116.4          114.5                112.4      102.6
5  1993  135.1        136.7          174.1                115.8      114.3
6  1994  118.2        118.0          103.8                110.7      111.7
7  1995  115.3        108.7           98.2                128.3      127.2
8  1996  103.9        110.2           99.3                 92.4       98.0
9  1997  101.3        109.3           97.4                 96.2       97.1
10 1998   95.8         99.1           95.1                 88.3       93.6
11 1999   96.7        100.9           94.7                 98.9       97.6
12 2000  105.1        115.4          100.9                110.3      105.6
13 2001   99.8        100.2          100.5                 95.6       98.4
14 2002   97.7        100.1           98.2                 96.5       97.5
15 2003  104.8        107.4          107.9                105.3      102.9
16 2004  111.4        109.7          120.4                120.1      108.9
17 2005  108.3        115.0          107.5                114.0      108.3
18 2006  106.0        111.9           98.3                130.8      102.1
19 2007  104.4        104.3          105.4                111.6      103.6
20 2008  110.5        120.6          118.4                 98.6      105.2
21 2009   92.1         89.2           86.3                 81.1       91.3
22 2010  109.6        116.3          106.6                122.2      107.0
23 2011  109.1        110.8          109.4                112.1      110.4
24 2012   98.2        100.9           92.9                 94.5       96.1
25 2013   98.0         96.6           95.7                 95.4       97.3
26 2014   97.8         97.1           94.6                 96.1       98.3
27 2015   93.9         88.7           88.4                 92.7       93.7
28 2016   98.0         95.6           97.7                 97.9       97.6
29 2017  108.1        113.0          115.9                115.3      108.4
30 2018  104.1        107.1          106.1                103.9      104.6
31 2019   99.3         98.2          102.3                 97.6       94.8
32 2020   97.7         91.6          100.5                 99.8       92.7
33 2021  111.0        120.5          120.3                120.9      115.1
34 2022  106.1        120.9           96.4                105.4      106.5
35 2023   96.4         94.7           93.8                 99.3       91.7
   木材及纸浆类 建筑材料及非金属类 农副产品类 纺织原料类
1         111.4              122.7      128.9      128.5
2          99.4              115.2      107.8      107.4
3         105.6              101.2      106.8      108.9
4         102.0              118.8      103.4      100.5
5         128.6              140.9      112.2      107.1
6         115.1              114.3      148.3      139.6
7         115.8              102.6      143.1      123.6
8         101.9              102.5      114.7       94.5
9         100.9               99.7      102.0       94.7
10         96.7               98.6       94.5       94.3
11        100.4               98.8       89.8       96.8
12         99.8              101.5       99.9      102.4
13        100.4               98.6      101.2       99.7
14         98.7               98.2       95.7       97.1
15        100.3               99.7      106.7      101.4
16        102.8              105.1      114.2      104.7
17        103.5              103.1      101.7      102.4
18        102.6              101.9      104.3      102.9
19        102.7              103.0      106.1      101.4
20        105.2              109.5      107.5      103.1
21         95.8              101.1       97.0       98.8
22        103.0              103.8      110.4      106.7
23        104.6              108.4      115.6      112.7
24        100.1               99.7      100.2       99.1
25         99.6               98.7      101.6       99.9
26         99.4               99.8       99.4       98.9
27         99.3               95.9       97.7       97.8
28         99.7               97.6      100.1       99.7
29        106.2              108.6      101.5      104.0
30        105.4              110.5       99.6      102.2
31         97.5              104.2      102.8       99.3
32         98.1              100.5      105.4       96.8
33        105.6              105.5      104.4      105.0
34        104.5              103.1      105.1      105.0
35         96.9               94.1       97.8       97.0

3.2 图形2——箱相图

p2 <- datatable %>%
  select(-年份, -总指数) %>%
  pivot_longer(everything(), names_to = "category", values_to = "index") %>%
  ggplot(aes(x = category, y = index, fill = category)) +
  geom_boxplot() +
  geom_jitter(width = 0.2, alpha = 0.5) +
  labs(title = "各类原材料价格指数波动情况(1989-2023)",
       x = "原材料类别",
       y = "价格指数") +
  theme_minimal() +
  theme(axis.text.x = element_text(angle = 45, hjust = 1))
ggplotly(p2)
  • 图形解读:箱线图显示燃料动力类的四分位距(IQR)达到28.5,远高于其他品类,且存在多个上边缘离群值。

    能源价格的高波动特性验证了其在工业成本管理中的关键地位,建议相关企业优先开展燃料价格的套期保值操作。

4 变量关系可视化

4.1 案例数据解释与展示

datatable
   年份 总指数 燃料、动力类 黑色金属材料类 有色金属材料及电线类 化工原料类
1  1989  126.4        124.7          130.3                127.6      124.4
2  1990  105.6        110.7          103.9                 97.2       95.6
3  1991  109.1        112.9          112.5                101.2       99.8
4  1992  111.0        116.4          114.5                112.4      102.6
5  1993  135.1        136.7          174.1                115.8      114.3
6  1994  118.2        118.0          103.8                110.7      111.7
7  1995  115.3        108.7           98.2                128.3      127.2
8  1996  103.9        110.2           99.3                 92.4       98.0
9  1997  101.3        109.3           97.4                 96.2       97.1
10 1998   95.8         99.1           95.1                 88.3       93.6
11 1999   96.7        100.9           94.7                 98.9       97.6
12 2000  105.1        115.4          100.9                110.3      105.6
13 2001   99.8        100.2          100.5                 95.6       98.4
14 2002   97.7        100.1           98.2                 96.5       97.5
15 2003  104.8        107.4          107.9                105.3      102.9
16 2004  111.4        109.7          120.4                120.1      108.9
17 2005  108.3        115.0          107.5                114.0      108.3
18 2006  106.0        111.9           98.3                130.8      102.1
19 2007  104.4        104.3          105.4                111.6      103.6
20 2008  110.5        120.6          118.4                 98.6      105.2
21 2009   92.1         89.2           86.3                 81.1       91.3
22 2010  109.6        116.3          106.6                122.2      107.0
23 2011  109.1        110.8          109.4                112.1      110.4
24 2012   98.2        100.9           92.9                 94.5       96.1
25 2013   98.0         96.6           95.7                 95.4       97.3
26 2014   97.8         97.1           94.6                 96.1       98.3
27 2015   93.9         88.7           88.4                 92.7       93.7
28 2016   98.0         95.6           97.7                 97.9       97.6
29 2017  108.1        113.0          115.9                115.3      108.4
30 2018  104.1        107.1          106.1                103.9      104.6
31 2019   99.3         98.2          102.3                 97.6       94.8
32 2020   97.7         91.6          100.5                 99.8       92.7
33 2021  111.0        120.5          120.3                120.9      115.1
34 2022  106.1        120.9           96.4                105.4      106.5
35 2023   96.4         94.7           93.8                 99.3       91.7
   木材及纸浆类 建筑材料及非金属类 农副产品类 纺织原料类
1         111.4              122.7      128.9      128.5
2          99.4              115.2      107.8      107.4
3         105.6              101.2      106.8      108.9
4         102.0              118.8      103.4      100.5
5         128.6              140.9      112.2      107.1
6         115.1              114.3      148.3      139.6
7         115.8              102.6      143.1      123.6
8         101.9              102.5      114.7       94.5
9         100.9               99.7      102.0       94.7
10         96.7               98.6       94.5       94.3
11        100.4               98.8       89.8       96.8
12         99.8              101.5       99.9      102.4
13        100.4               98.6      101.2       99.7
14         98.7               98.2       95.7       97.1
15        100.3               99.7      106.7      101.4
16        102.8              105.1      114.2      104.7
17        103.5              103.1      101.7      102.4
18        102.6              101.9      104.3      102.9
19        102.7              103.0      106.1      101.4
20        105.2              109.5      107.5      103.1
21         95.8              101.1       97.0       98.8
22        103.0              103.8      110.4      106.7
23        104.6              108.4      115.6      112.7
24        100.1               99.7      100.2       99.1
25         99.6               98.7      101.6       99.9
26         99.4               99.8       99.4       98.9
27         99.3               95.9       97.7       97.8
28         99.7               97.6      100.1       99.7
29        106.2              108.6      101.5      104.0
30        105.4              110.5       99.6      102.2
31         97.5              104.2      102.8       99.3
32         98.1              100.5      105.4       96.8
33        105.6              105.5      104.4      105.0
34        104.5              103.1      105.1      105.0
35         96.9               94.1       97.8       97.0

4.2 图形3——带边际分布的散点图

library(ggExtra)

p3 <- ggplot(datatable, aes(x = `建筑材料及非金属类`, y = `木材及纸浆类`)) +
  geom_point(aes(size = 总指数), color = "darkgreen", alpha = 0.6) +
  labs(title = "建材与木材价格关系(气泡大小反映总指数)",
       x = "建筑材料类指数",
       y = "木材及纸浆类指数") +
  theme_minimal()

ggMarginal(p3, type = "histogram", fill = "lightgreen")

p3

  • 图形解读

    • 主图显示两类价格呈弱正相关(r=0.31)

    • 边缘直方图揭示建材价格呈双峰分布

    • 大型气泡(高总指数年份)多分布在右上区域

    建筑业繁荣期(如2003-2004、2009-2010)会同步拉动两类材料价格,但平时联动性不强。1993年:黑色金属(174.1)和建筑材料(140.9)异常突出,显示当时基建投资过热

5 样本相似性可视化

5.1 案例数据解释与展示

datatable
   年份 总指数 燃料、动力类 黑色金属材料类 有色金属材料及电线类 化工原料类
1  1989  126.4        124.7          130.3                127.6      124.4
2  1990  105.6        110.7          103.9                 97.2       95.6
3  1991  109.1        112.9          112.5                101.2       99.8
4  1992  111.0        116.4          114.5                112.4      102.6
5  1993  135.1        136.7          174.1                115.8      114.3
6  1994  118.2        118.0          103.8                110.7      111.7
7  1995  115.3        108.7           98.2                128.3      127.2
8  1996  103.9        110.2           99.3                 92.4       98.0
9  1997  101.3        109.3           97.4                 96.2       97.1
10 1998   95.8         99.1           95.1                 88.3       93.6
11 1999   96.7        100.9           94.7                 98.9       97.6
12 2000  105.1        115.4          100.9                110.3      105.6
13 2001   99.8        100.2          100.5                 95.6       98.4
14 2002   97.7        100.1           98.2                 96.5       97.5
15 2003  104.8        107.4          107.9                105.3      102.9
16 2004  111.4        109.7          120.4                120.1      108.9
17 2005  108.3        115.0          107.5                114.0      108.3
18 2006  106.0        111.9           98.3                130.8      102.1
19 2007  104.4        104.3          105.4                111.6      103.6
20 2008  110.5        120.6          118.4                 98.6      105.2
21 2009   92.1         89.2           86.3                 81.1       91.3
22 2010  109.6        116.3          106.6                122.2      107.0
23 2011  109.1        110.8          109.4                112.1      110.4
24 2012   98.2        100.9           92.9                 94.5       96.1
25 2013   98.0         96.6           95.7                 95.4       97.3
26 2014   97.8         97.1           94.6                 96.1       98.3
27 2015   93.9         88.7           88.4                 92.7       93.7
28 2016   98.0         95.6           97.7                 97.9       97.6
29 2017  108.1        113.0          115.9                115.3      108.4
30 2018  104.1        107.1          106.1                103.9      104.6
31 2019   99.3         98.2          102.3                 97.6       94.8
32 2020   97.7         91.6          100.5                 99.8       92.7
33 2021  111.0        120.5          120.3                120.9      115.1
34 2022  106.1        120.9           96.4                105.4      106.5
35 2023   96.4         94.7           93.8                 99.3       91.7
   木材及纸浆类 建筑材料及非金属类 农副产品类 纺织原料类
1         111.4              122.7      128.9      128.5
2          99.4              115.2      107.8      107.4
3         105.6              101.2      106.8      108.9
4         102.0              118.8      103.4      100.5
5         128.6              140.9      112.2      107.1
6         115.1              114.3      148.3      139.6
7         115.8              102.6      143.1      123.6
8         101.9              102.5      114.7       94.5
9         100.9               99.7      102.0       94.7
10         96.7               98.6       94.5       94.3
11        100.4               98.8       89.8       96.8
12         99.8              101.5       99.9      102.4
13        100.4               98.6      101.2       99.7
14         98.7               98.2       95.7       97.1
15        100.3               99.7      106.7      101.4
16        102.8              105.1      114.2      104.7
17        103.5              103.1      101.7      102.4
18        102.6              101.9      104.3      102.9
19        102.7              103.0      106.1      101.4
20        105.2              109.5      107.5      103.1
21         95.8              101.1       97.0       98.8
22        103.0              103.8      110.4      106.7
23        104.6              108.4      115.6      112.7
24        100.1               99.7      100.2       99.1
25         99.6               98.7      101.6       99.9
26         99.4               99.8       99.4       98.9
27         99.3               95.9       97.7       97.8
28         99.7               97.6      100.1       99.7
29        106.2              108.6      101.5      104.0
30        105.4              110.5       99.6      102.2
31         97.5              104.2      102.8       99.3
32         98.1              100.5      105.4       96.8
33        105.6              105.5      104.4      105.0
34        104.5              103.1      105.1      105.0
35         96.9               94.1       97.8       97.0

5.2 图形4——雷达图

key_years <- c(1993, 2008, 2015, 2020, 2022)
key_data <- datatable %>% filter(年份 %in% key_years)
p4 <- plot_ly(datatable, type = 'scatterpolar', mode = 'lines+markers') %>%
  add_trace(r = ~`燃料、动力类`, theta = names(key_data)[3], name = key_data$年份[1]) %>%
  add_trace(r = ~`燃料、动力类`, theta = names(key_data)[3], name = key_data$年份[2]) %>%
  add_trace(r = ~`燃料、动力类`, theta = names(key_data)[3], name = key_data$年份[3]) %>%
  add_trace(r = ~`燃料、动力类`, theta = names(key_data)[3], name = key_data$年份[4]) %>%
  add_trace(r = ~`燃料、动力类`, theta = names(key_data)[3], name = key_data$年份[5]) %>%
  layout(polar = list(radialaxis = list(visible = T, range = c(0, 180))),
         title = "关键年份各类原材料价格指数对比")
p4
  • 图形解读:雷达图对比了1993、2008、2015、2020和2022五个关键年份的价格结构。2022年图形呈现明显的”燃料动力尖峰”特征,该品类指数高达120.9。

    关键观点:2022年俄乌冲突导致的能源危机在图形中得到直观体现,这种单品类剧烈波动提示能源密集型行业需要建立更灵活的成本传导机制

6 时间序列可视化

6.1 案例数据解释与展示

datatable
   年份 总指数 燃料、动力类 黑色金属材料类 有色金属材料及电线类 化工原料类
1  1989  126.4        124.7          130.3                127.6      124.4
2  1990  105.6        110.7          103.9                 97.2       95.6
3  1991  109.1        112.9          112.5                101.2       99.8
4  1992  111.0        116.4          114.5                112.4      102.6
5  1993  135.1        136.7          174.1                115.8      114.3
6  1994  118.2        118.0          103.8                110.7      111.7
7  1995  115.3        108.7           98.2                128.3      127.2
8  1996  103.9        110.2           99.3                 92.4       98.0
9  1997  101.3        109.3           97.4                 96.2       97.1
10 1998   95.8         99.1           95.1                 88.3       93.6
11 1999   96.7        100.9           94.7                 98.9       97.6
12 2000  105.1        115.4          100.9                110.3      105.6
13 2001   99.8        100.2          100.5                 95.6       98.4
14 2002   97.7        100.1           98.2                 96.5       97.5
15 2003  104.8        107.4          107.9                105.3      102.9
16 2004  111.4        109.7          120.4                120.1      108.9
17 2005  108.3        115.0          107.5                114.0      108.3
18 2006  106.0        111.9           98.3                130.8      102.1
19 2007  104.4        104.3          105.4                111.6      103.6
20 2008  110.5        120.6          118.4                 98.6      105.2
21 2009   92.1         89.2           86.3                 81.1       91.3
22 2010  109.6        116.3          106.6                122.2      107.0
23 2011  109.1        110.8          109.4                112.1      110.4
24 2012   98.2        100.9           92.9                 94.5       96.1
25 2013   98.0         96.6           95.7                 95.4       97.3
26 2014   97.8         97.1           94.6                 96.1       98.3
27 2015   93.9         88.7           88.4                 92.7       93.7
28 2016   98.0         95.6           97.7                 97.9       97.6
29 2017  108.1        113.0          115.9                115.3      108.4
30 2018  104.1        107.1          106.1                103.9      104.6
31 2019   99.3         98.2          102.3                 97.6       94.8
32 2020   97.7         91.6          100.5                 99.8       92.7
33 2021  111.0        120.5          120.3                120.9      115.1
34 2022  106.1        120.9           96.4                105.4      106.5
35 2023   96.4         94.7           93.8                 99.3       91.7
   木材及纸浆类 建筑材料及非金属类 农副产品类 纺织原料类
1         111.4              122.7      128.9      128.5
2          99.4              115.2      107.8      107.4
3         105.6              101.2      106.8      108.9
4         102.0              118.8      103.4      100.5
5         128.6              140.9      112.2      107.1
6         115.1              114.3      148.3      139.6
7         115.8              102.6      143.1      123.6
8         101.9              102.5      114.7       94.5
9         100.9               99.7      102.0       94.7
10         96.7               98.6       94.5       94.3
11        100.4               98.8       89.8       96.8
12         99.8              101.5       99.9      102.4
13        100.4               98.6      101.2       99.7
14         98.7               98.2       95.7       97.1
15        100.3               99.7      106.7      101.4
16        102.8              105.1      114.2      104.7
17        103.5              103.1      101.7      102.4
18        102.6              101.9      104.3      102.9
19        102.7              103.0      106.1      101.4
20        105.2              109.5      107.5      103.1
21         95.8              101.1       97.0       98.8
22        103.0              103.8      110.4      106.7
23        104.6              108.4      115.6      112.7
24        100.1               99.7      100.2       99.1
25         99.6               98.7      101.6       99.9
26         99.4               99.8       99.4       98.9
27         99.3               95.9       97.7       97.8
28         99.7               97.6      100.1       99.7
29        106.2              108.6      101.5      104.0
30        105.4              110.5       99.6      102.2
31         97.5              104.2      102.8       99.3
32         98.1              100.5      105.4       96.8
33        105.6              105.5      104.4      105.0
34        104.5              103.1      105.1      105.0
35         96.9               94.1       97.8       97.0

6.2 图形5—多系列折线图

p5 <- plot_ly(datatable, x = ~年份) %>%
  add_lines(y = ~总指数, name = "总指数", line = list(color = 'black', width = 3)) %>%
  add_lines(y = ~`燃料、动力类`, name = "燃料、动力类") %>%
  add_lines(y = ~`黑色金属材料类`, name = "黑色金属材料类") %>%
  add_lines(y = ~`有色金属材料及电线类`, name = "有色金属材料类") %>%
  add_lines(y = ~`化工原料类`, name = "化工原料类") %>%
  add_lines(y = ~`木材及纸浆类`, name = "木材及纸浆类") %>%
  add_lines(y = ~`建筑材料及非金属类`, name = "建筑材料类") %>%
  add_lines(y = ~`农副产品类`, name = "农副产品类") %>%
  add_lines(y = ~`纺织原料类`, name = "纺织原料类") %>%
  layout(title = "工业生产者购进价格指数长期趋势(1989-2023)",
         xaxis = list(title = "年份"),
         yaxis = list(title = "价格指数(上年=100)"),
         hovermode = "x unified",
         legend = list(orientation = "h", x = 0.1, y = -0.2))
p5
  • 图形解读:该折线图清晰展示了1989-2023年间各品类价格指数的波动轨迹。特别值得注意的是,2021年所有品类出现同步上涨,总指数达到111.0,创2008年金融危机后最高水平。

    这种全品类同步上涨现象反映出2021年全球供应链中断和宽松货币政策对工业成本的全面冲击,建议企业在此类宏观环境下加强原材料库存管理。