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?
如何制作堆积条形图,其中x轴上的日期和y轴上的频率以及为相对大小和不同颜色显示的每个日期堆叠的不同ID?
1 个解决方案
#1
1
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)
#1
1
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)