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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.