r中的警告消息
我正在尝试更改堆叠条形图上的Y标签,因为它似乎正在制作值总计3的值。
这是我的数据框架:
Morph Choice Value
1 Orange Orange 1.7333330
2 Orange Green 1.2666670
3 Green Orange 0.8666667
4 Green Green 2.1333333
这是我用于生成堆叠条形图的脚本;
ggp2M<- ggplot(data = forbargraphMEANS.df,
aes(x = Morph,
y = Value,
fill = Choice))+
geom_bar(position = "fill", stat = "identity") + scale_y_continuous(limits=c(0,3))
会产生此警告信息;
Warning message:
Removed 4 rows containing missing values (position_stack).
(没有“ scale_y_continuul(limits = c(0,3))”,它起作用,但y为0.00-1.00)。
我不知道如何使其0-3而不是0-1。同样,如果数据集中的3个值超过1,为什么会真正混淆为什么要做0-1。
让我知道这是否没有意义。 先感谢您。
NB我已经用不同的数据集创建了我想要的东西,该数据集要求y是一个百分比。
I am trying to change the y label on a stacked bar graph because it seems to be making values that add up to 3 add up to 1 instead.
Here is my data frame:
Morph Choice Value
1 Orange Orange 1.7333330
2 Orange Green 1.2666670
3 Green Orange 0.8666667
4 Green Green 2.1333333
Here is my script for generating a stacked bar graph;
ggp2M<- ggplot(data = forbargraphMEANS.df,
aes(x = Morph,
y = Value,
fill = Choice))+
geom_bar(position = "fill", stat = "identity") + scale_y_continuous(limits=c(0,3))
which creates this warning message;
Warning message:
Removed 4 rows containing missing values (position_stack).
(Without "scale_y_continuous(limits=c(0,3))" it works but y is 0.00 - 1.00).
I can't figure out how to make it 0-3 rather than 0-1. Also just genuinely confused why it would do 0-1 if 3 of the values in the dataset are more than 1.
Let me know if any of this doesn't make sense.
Thank you in advance.
N.B. I have created exactly what I wanted with a different dataset that required y to be a percentage.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我没有看到任何警告,但是我对您的确切想要的东西有些困惑。
以上是您的代码,输出在下面

如果您希望它加起来多达三个,则可以使用以下代码(删除
position = “填充”
part)I am not seeing any warning, but I a little confused about what you exactly want.
Above is your code, and the output is below

If you want it to add up to three, then you can use the following code (remove the
position = "fill"
part)