Bart6114 wrote on 01/20/2012 08:54:39 AM: > Hey, > > I want to create a stacked barchart in R for the following dataset > (http://pastebin.com/pyHUNgr2): > > # usage capacity diff > 1 4 10 6 > 2 2 20 18 > 3 5 10 5 > > The stacked barchart should, in one plot show each line of the dataset as a > stacked bar using data from 'usage' and 'diff' to create the stacked bar. > > I can't find a good example of how to do this on the ggplot2 site. > > Thanks in advance!
See the help on barplot: ?barplot For example: df <- data.frame(usage=c(4, 2, 5), capacity=c(10, 20, 10), diff=c(6, 18, 5)) barplot(t(as.matrix(df[, 1:2]))) Jean [[alternative HTML version deleted]] ______________________________________________ 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.