我一直在尝试使用the thin line marking a hspine with the count of 0 (second column)来绘制一个马赛克/马里梅科图,但我希望删除它。
这可以在ggmosaic中完成吗?我在vignette / help文件中找不到方法。下面是一个可重现的例子。
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))发布于 2017-03-09 15:14:21
我不知道它是否可以在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))https://stackoverflow.com/questions/42612085
复制相似问题