Created
April 2, 2016 14:36
-
-
Save jilmun/e67033bcceb67e7933c1596be06e7fed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(ggplot2) | |
# prepare south park data ------------------------------------------------- | |
d2 <- data.frame(member=c(rep("Eric",5), | |
rep("Kyle",5), | |
rep("Stan",5), | |
rep("Kenny",5)), | |
shade=c("EricPants","EricShirt","Skin","EricHat","EricPomPom", | |
"KylePants","KyleShirt","Skin","KyleHatBottom","KyleHatTop", | |
"StanPants","StanShirt","Skin","StanBottom","StanHatTop", | |
"KennyOutfit","KennyBand","Skin","KennyBand","KennyOutfit"), | |
height=c(5,20,25,5,5, | |
5,20,25,5,5, | |
5,20,25,5,5, | |
30,5,5,5,15), | |
wideness=c(rep(1,5), | |
rep(0.5,5), | |
rep(0.5,5), | |
rep(0.5,5))) | |
d2$member <- ordered(d2$member,levels=c("Eric","Kyle","Stan","Kenny")) | |
d2$shade <- ordered(d2$shade,levels=c("EricPants","EricShirt","Skin","EricHat","EricPomPom", | |
"KylePants","KyleShirt","KyleHatBottom","KyleHatTop", | |
"StanPants","StanShirt","StanBottom","StanHatTop", | |
"KennyOutfit","KennyBand")) | |
# chart south park -------------------------------------------------------- | |
g2 <- ggplot(d2,aes(x=member,y=height,width=wideness,fill=shade)) + | |
geom_bar(stat="identity") + | |
scale_fill_manual(values=c("#945b47","#bd022c","#f6dfd5","#50e5fb","#fbf450", | |
"#945b47","#ee590f","#56dd12","#56dd12", | |
"#215cdb","#945b47","#bd022c","#215cdb", | |
"#ee590f","#945b47")) + | |
theme(legend.position="none", | |
axis.title.x=element_blank(), | |
axis.title.y=element_blank(), | |
axis.text.x=element_blank(), | |
axis.text.y=element_blank()) + | |
ylim(0, 150) + | |
ggtitle("South Park Characters") | |
g2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment