Reputation: 91
I have a data frame that looks like this:
date id freq
6/17/12 0417D0214D 81
6/17/12 0417D2F96C 275
6/18/12 04179385A3 1
6/18/12 041793A84F 2
6/18/12 0417CA9138 2
6/18/12 0417D0214D 120
How can I make a stacked bar plot with date on the x axis and frequency on the y axis and the different ids stacked for each date shown with relative size and different colors?
Upvotes: 1
Views: 276
Reputation: 263481
That's not a lot to work with being only one category but here goes:
dat <- read.table(text="date id freq
6/17/12 0417D0214D 81
6/17/12 0417D2F96C 275
6/18/12 04179385A3 1
6/18/12 041793A84F 2
6/18/12 0417CA9138 2
6/18/12 0417D0214D 120", header=TRUE)
barplot(as.matrix(dat$freq) , beside=FALSE)
Upvotes: 1