【发布时间】:2019-06-27 22:38:33
【问题描述】:
我正在尝试绘制这个数据集(fullmala):
order_name CO1 V1 V4 V9
<chr> <dbl> <dbl> <dbl> <dbl>
1 Amphipoda 8633 38 6 54
2 Bathynellacea 1 0 0 0
3 Cumacea 97 1 0 0
4 Decapoda 25138 0 0 0
5 Euphausiacea 1627 0 0 0
6 Isopoda 3607 115 106 102
我真正想要的是每个 order_name 的分组条形图,CO1、V1、V4、V9 有 4 个 Y 值。
我试过了:
color.names = c("black","grey40","grey80","white")
barplot(t(fullmala),beside=T,ylim=c(0,100),xlab="Orders",ylab="Representativeness", col=color.names,axis.lty="solid")
但我得到一个错误: -0.01 * height 中的错误:二元运算符的非数字参数。
【问题讨论】:
-
试试
t(fullmala[-1])- 你现在包括你的非数字order_name列。 -
barplot(prop.table(as.matrix(fullmala[-1]),2)*100)或类似的东西,如果你也想比较比例,这可能更有意义。