简体   繁体   English

R中的堆积Barplot问题

[英]Stacked Barplot issue in R

I have a data frame matrix (see pic1), and am trying to create a stacked barplot with the column variables on the x axis. 我有一个数据帧矩阵(请参见pic1),并且正在尝试使用x轴上的列变量创建一个堆积的条形图。 Using the following code, 使用以下代码,

barplot(as.matrix(africana06, beside=FALSE, legend=TRUE, ylab=c("Relative Total Damage"), xlab=c("Damage Type"), ylim=c(0,200), col=terrain.colors(4)))

I get a stacked barplot (see pic2), but it does not seem to take any of the arguments in my code. 我得到了一个堆积的条形图(请参见pic2),但是它似乎没有接受代码中的任何参数。 Anyone have any suggestions? 有人有什么建议吗? Thanks! 谢谢!

Ryan 瑞安

pic1 pic2 图片 1 图片2

“问题可能很简单,实际上所有参数(旁边= FALSE,图例= TRUE等)都传递给了as.matrix()而不是barplot()。在africana06之后添加一个右括号(并删除一个右括号)最后)。– Stibu”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM