An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110719/9ae7afa7/attachment.pl>
Stacked Bar Plot in ggplot2
2 messages · Abraham Mathew, Justin Haynes
Abraham Mathew <abraham <at> thisorthat.com> writes:
I'm trying to develop a stacked bar plot in R with ggplot2.
My data:
conv = c(10, 4.76, 17.14, 25, 26.47, 37.5, 20.83, 25.53, 32.5, 16.7, 27.33)
click = c(20, 42, 35, 28, 34, 48, 48, 47, 40, 30, 30)
date = c("July 7", "July 8", "July 9", "July 10", "July 11", "July 12",
"July 13",
"July 14", "July 15", "July 16", "July 17")
dat <- data.frame(date=c(date), click=c(click), conv=c(conv),
stringsAsFactors = FALSE)
Is: ggplot(dat,aes(x=date))+geom_bar(aes(y=click),fill='red')+geom_bar(aes(y=conv),fill='blue') what you're looking for? or dat.melt<-melt(dat,'date') ggplot(dat.melt,aes(x=date,y=value,fill=variable))+geom_bar() Justin