[R] Plotting Stacked Bar

Richard M. Heiberger rmh at temple.edu
Wed Nov 25 15:21:31 CET 2009


## Your original data is already the result of table().

## Here are two versions, one using barchart and one barplot.


tmpc <- textConnection("
Month      Core(%)   Non_core(%)
1             45                55
2             48                52
3             36                64
4             60                40
5             35                65
")

tmp <- data.matrix(read.table(tmpc, header=TRUE, row.names="Month"))
close(tmpc)

barchart(tmp, horizontal=FALSE)

barplot(t(tmp))




More information about the R-help mailing list