我的数据集如下所示:
emissions<-structure(
list(
name = c(
"China",
"United States of America",
"India",
"Russia",
"Japan",
"China",
"United States of America",
"India",
"Russia",
"Japan",
"China",
"United States of America",
"India",
"Russia",
"Japan"
),
iso = c(
"CHN",
"USA",
"IND",
"RUS",
"JPN",
"CHN",
"USA",
"IND",
"RUS",
"JPN",
"CHN",
"USA",
"IND",
"RUS",
"JPN"
),
year = c(
2019,
2019,
2019,
2019,
2019,
2020,
2020,
2020,
2020,
2020,
2021,
2021,
2021,
2021,
2021
),
total = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
coal = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
oil = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
gas = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
cement = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
flaring = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
other = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10),
per_capita = c(100,
75, 50, 25, 10, 100,
75, 50, 25, 10, 100,
75, 50, 25, 10)
),
row.names = c(NA,-15L),
class = c("data.table",
"data.frame")
)
我提供的样本是一个例子,我有自1750年以来230多个国家的数据(排放量)。我试图用折线图描绘过去10年(2012年至2022年)每一类别(煤炭、石油、天然气、水泥、燃烧、其他)的排放量。
我不知道如何做到这一点。任何帮助将不胜感激。
谢谢你。
1条答案
按热度按时间syqv5f0l1#
我想出了如何使用highchart创建这个:
注:全球排放量载于成为参照点的数据集中。