0

我一直在尝试使用 ggmosaic 制作 Mosaic / Marimekko 图,但希望删除标记 hspine 的细线,计数为 0 (second column)

这可以在ggmosaic中完成吗?我在小插图/帮助文件中找不到如何。下面是一个可重现的例子。

library(ggmosaic)    

happy2 <- happy
happy2$marital <- 
  ifelse(happy2$marital == "never married" & happy2$happy == "not too happy",
       NA, happy2$marital)

ggplot(happy2) + 
  geom_mosaic(aes(x = product(happy, marital), fill = happy))
4

1 回答 1

0

不知道它是否可以在 ggmosaic 中调整,但事实证明这个情节可以很容易地用 ggplot 完成

happy2 <- happy
happy2$marital <- 
  ifelse(happy2$marital == "never married" & happy2$happy == "not too happy",
       NA, happy2$marital)

ggplot(happy2) + 
  geom_histogram(aes(x = marital, fill = happy), colour = "black", 
               width = 1, stat = "count", position = "fill") +
  scale_y_continuous(expand = c(0,0)) +
  scale_x_discrete(expand = c(0,0))
于 2017-03-09T07:14:20.577 回答