从 excel 到 ggplot2 的 Facet 和 Stacked 条形图
Facet and Stacked bar plot from excel to ggplot2
我想重新制作我在 excel + MS.pptx 上做的下图。我这样做是因为我想要一个最精致的人物。但是,我很挣扎。
我在 R 中使用 ggplot2,但在 facet 上苦苦挣扎
data %>%
ggplot(aes(x = year,
y = metric )) +
geom_bar(stat = "identity") +
theme_bw() +
theme(panel.grid = element_blank()) +
facet_wrap(~scenario)
Here you can find the reproducible data.
非常感谢您提供启动图形的指导。
ggplot(dat, aes(year, value, fill=fuel)) +
geom_col() +
facet_grid(metric~scenario, scales="free", space="fixed") +
scale_x_continuous(breaks=c(2010, 2030, 2050)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))
我想重新制作我在 excel + MS.pptx 上做的下图。我这样做是因为我想要一个最精致的人物。但是,我很挣扎。
我在 R 中使用 ggplot2,但在 facet 上苦苦挣扎
data %>%
ggplot(aes(x = year,
y = metric )) +
geom_bar(stat = "identity") +
theme_bw() +
theme(panel.grid = element_blank()) +
facet_wrap(~scenario)
Here you can find the reproducible data.
非常感谢您提供启动图形的指导。
ggplot(dat, aes(year, value, fill=fuel)) +
geom_col() +
facet_grid(metric~scenario, scales="free", space="fixed") +
scale_x_continuous(breaks=c(2010, 2030, 2050)) +
theme(axis.text.x = element_text(angle = 45, hjust = 1))