# NOT RUN {
data(Titanic)
titanic <- as.data.frame(Titanic)
titanic$Survived <- factor(titanic$Survived, levels=c("Yes", "No"))
ggplot(data=titanic) +
geom_mosaic(aes(weight=Freq, x=product(Survived, Class), fill=Survived))
# }
Run the code above in your browser using DataCamp Workspace