【发布时间】:2019-06-24 19:05:00
【问题描述】:
我正在制作一个线图,并希望在其旁边绘制带有置信区间的平均值。我可以将数据绘制成线图,但效果不太好,因为数据非常分散。
数据如下所示:
subsidy_to_port tick industry_cost_to_store
1 20 7 1900000
2 20 8 2800000
3 20 9 3700000
4 20 10 4600000
5 20 11 5500000
6 20 12 6400000
7 20 13 7300000
8 20 14 10300000
9 20 15 13300000
10 20 16 16300000
对端口的补贴以 20 为步长从 0 到 100%,我希望在一个图中显示 5 个不同的图表。刻度从 0 到 32,industry_cost_to_store 逐渐上升。我为正常情节尝试了这个:
StoredCO215mln <- ggplot(i3, aes(x = tick, y =
total_co2_emissions_captured)) + geom_point(aes(color =
factor(subsidy_to_port))) + ylab("Amount CO2 captured") + labs(title
= "Total CO2 captured in 32 years (subsidy = 15mln)") +
scale_color_discrete(name="Subsidy to port (%)")
选择点会产生很多分散的点,geom_line 只是不适用于这些数据。如您所见,数据集称为 i3。我查看了 geom_ribbon 命令,但无法弄清楚它是如何工作的。所有帮助表示赞赏!非常感谢。
最大
【问题讨论】:
-
geom_smooth是你想要的吗?听起来是这样。