I've been trying to make a Mosaic / Marimekko plot using ggmosaic, but would wish to remove the thin line marking a hspine with the count of 0 (second column) .
Can this be done in ggmosaic? I couldn't find how in the vignette / help files. A reproducible example below.
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))
Don't know whether or not it could be adjusted in ggmosaic, but it turned out this plot can be done very easily with 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))