Skip to content

Instantly share code, notes, and snippets.

@masaha03
Last active December 30, 2015 00:18
Show Gist options
  • Save masaha03/7748124 to your computer and use it in GitHub Desktop.
Save masaha03/7748124 to your computer and use it in GitHub Desktop.
library(ggplot2)
t1 <- as.table(Titanic[1:3,,2,2])
fortify.table <- function(model, ...) {
data <- reshape2::melt(model)
return(data)
}
p1 <- ggplot(data=t1)
p1 + geom_bar(aes(Sex, value, fill=Class),
stat="identity")
p1 + geom_bar(aes(Sex, value, fill=Class),
stat="identity",
position="fill") + coord_flip()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment