首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使冲积层x轴与y轴上的零点对齐?

如何使冲积层x轴与y轴上的零点对齐?
EN

Stack Overflow用户
提问于 2019-09-12 07:45:55
回答 1查看 339关注 0票数 1

我在想我们怎么能把x轴和y轴上的零对齐。我尝试用ylim(0, 1000)来调整限制,但是这似乎不起作用。

代码语言:javascript
复制
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")

看这里的情节,用一个蓝色的标记,标记我想要删除的空间。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-12 08:01:16

代码语言:javascript
复制
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")

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57902013

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档