从矩阵创建条形图

时间:2015-03-27 10:40:10

标签: r

所以,我有一个像这样的矩阵:

> dput(tbl_sum_peaks[1:40])
structure(c(2, 8, 3, 4, 1, 2, 1, 3, 1, 3, 1, 4, 4, 2, 1, 1, 2, 
1, 1, 1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 2, 1, 5, 4, 2, 1, 1, 2, 1, 
4, 2), .Names = c("AT1G01050", "AT1G01080", "AT1G01090", "AT1G01320", 
"AT1G01470", "AT1G01800", "AT1G01910", "AT1G01960", "AT1G01980", 
"AT1G02150", "AT1G02470", "AT1G02500", "AT1G02560", "AT1G02780", 
"AT1G02816", "AT1G02880", "AT1G02920", "AT1G02930", "AT1G03030", 
"AT1G03090", "AT1G03110", "AT1G03210", "AT1G03220", "AT1G03230", 
"AT1G03330", "AT1G03475", "AT1G03630", "AT1G03680", "AT1G03740", 
"AT1G03870", "AT1G04080", "AT1G04170", "AT1G04270", "AT1G04410", 
"AT1G04420", "AT1G04530", "AT1G04640", "AT1G04650", "AT1G04690", 
"AT1G04750"))

我想制作一个条形图,其中yaxis具有特定数字的行数。正如我们所看到的那样,给定的示例数据大多数行的数字为1,因此数字1的条形图将是最高的。

这是一个基本但我不能打开我的大脑...所以有人的帮助会得到奖励!

1 个答案:

答案 0 :(得分:5)

尝试

barplot(table(tbl_sum_peaks))