I want to make mosaic plot in ggplot2,by geom_mosaic
I want to make mosaic plot, in ggplot2. that will be as same as this.
library(faraway)
(ct <- xtabs(y ~ right + left, eyegrade))
mosaicplot(ct, color = c("lightblue"),xlab="Right eye",ylab="Left eye")
I have data frame eyegrade, but I don't know, how to set aes.
library(ggplot2)
library(ggmosaic)
ggplot(data = eyegrade) +
geom_mosaic(aes(x = product(left,right)))
thank you