library(ggplot2)
d <- as.data.frame(Titanic)
ggplot(d) +
aes(x = Class, fill = Survived, weight = Freq) +
geom_prop_bar() +
geom_prop_text() +
geom_prop_connector()
ggplot(d) +
aes(y = Class, fill = Survived, weight = Freq) +
geom_prop_bar(width = .5) +
geom_prop_text() +
geom_prop_connector(width = .5, linetype = "dotted")
ggplot(d) +
aes(
x = Class,
fill = Survived,
weight = Freq,
y = after_stat(count),
label = after_stat(count)
) +
geom_prop_bar() +
geom_prop_text() +
geom_prop_connector()
Run the code above in your browser using DataLab