Skip to content

Plotting Stacked Bar

2 messages · Julia Cains, Richard M. Heiberger

#
## 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))