我在想我们怎么能把x轴和y轴上的零对齐。我尝试用ylim(0, 1000)来调整限制,但是这似乎不起作用。
library(ggalluvial)
data(vaccinations)
vaccinations <- vaccinations[-c(94),]
levels(vaccinations$response) <- rev(levels(vaccinations$response))
ggplot(vaccinations,
aes(x = survey, stratum = response, alluvium = subject,
y = freq,
fill = response, label = response)) +
scale_x_discrete(expand = c(.1, .1)) +
geom_flow() +
geom_stratum(alpha = .5) +
geom_text(stat = "stratum", size = 3) +
theme(legend.position = "none") +
ggtitle("vaccination survey responses at three points in time")看这里的情节,用一个蓝色的标记,标记我想要删除的空间。

发布于 2019-09-12 08:01:16
ggplot(vaccinations,
aes(x = survey, stratum = response, alluvium = subject,
y = freq,
fill = response, label = response)) +
scale_x_discrete(expand = c(.1, .1)) +
#adjust the y scale:
scale_y_continuous(expand = c(0, 0), limits = c(0, 1000)) +
geom_flow() +
geom_stratum(alpha = .5) +
geom_text(stat = "stratum", size = 3) +
theme(legend.position = "none") +
ggtitle("vaccination survey responses at three points in time")

https://stackoverflow.com/questions/57902013
复制相似问题