楼主: wumujusha
7165 8

[问答] ggplot画条形图出现警告求解 [推广有奖]

  • 5关注
  • 8粉丝

已卖:1375份资源

讲师

43%

还不是VIP/贵宾

-

威望
0
论坛币
25680 个
通用积分
17.5409
学术水平
10 点
热心指数
14 点
信用等级
11 点
经验
36490 点
帖子
317
精华
0
在线时间
660 小时
注册时间
2008-10-12
最后登录
2025-6-1

楼主
wumujusha 发表于 2014-3-10 23:21:41 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
> p <- ggplot(m_rtn,aes(x=Month,y=Return))+
+ geom_bar()+
+ labs(title="Monthly Return")
> print(p)
出现如下警告,为啥呢?怎么破
Mapping a variable to y and also using stat="bin".
  With stat="bin", it will attempt to set the y value to the count of cases in each group.
  This can result in unexpected behavior and will not be allowed in a future version of ggplot2.
  If you want y to represent counts of cases, use stat="bin" and don't map a variable to y.
  If you want y to represent values in the data, use stat="identity".
  See ?geom_bar for examples. (Deprecated; last used in version 0.9.2)
Warning message:
Stacking not well defined when ymin != 0

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:gplot plot 条形图 GPL Unexpected unexpected represent examples identity version

沙发
wumujusha 发表于 2014-3-11 14:49:52
顶,怎么没人回应啊

藤椅
wumujusha 发表于 2014-3-12 15:08:10
还是没有人啊。。。。。。。。。。。

板凳
xuxf101 发表于 2014-3-14 17:56:22
提示: 作者被禁止或删除 内容自动屏蔽

报纸
rainbow19720731 发表于 2014-3-14 19:25:57
支持下
阿弥陀佛---我只相信科学

地板
fssdlyl001 发表于 2014-5-19 09:25:27
嗯,我之前也遇到过,把stat定义为"indentity"应该就好了

7
墨名 发表于 2014-12-1 20:35:59
恩,已经试验过,加入stat=“identity”就好了

8
lijianguo531 发表于 2016-7-18 15:30:19
墨名 发表于 2014-12-1 20:35
恩,已经试验过,加入stat=“identity”就好了
请问identity、bin和count有什么区别

9
jlwjlwjlw 发表于 2017-5-23 17:01:47
“绘图函数里的stat参数表示对样本点做统计的方式,默认为identity,表示一个x对应一个y,同时还可以是bin,表示一个x对应落到该x的样本数。”说白了就是,identity提取横坐标x对应的y值,bin提取横坐标x的频数。
资料来源:http://www.cnblogs.com/muchen/p/5279727.html
下面是R帮助中的说明:
“If you have presummarised data, use <code>stat="identity" to turn off the default summary. Sometimes, bar charts are used not as a distributional summary, but instead of a dotplot. Generally, it's preferable to use a dotplot (see geom\_point) as it has a better data-ink ratio. However, if you do want to create this type of plot, you can set y to the value you have calculated, and use stat='identity'.”
资料来源:http://127.0.0.1:10246/library/ggplot2/html/geom_bar.html

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-25 13:47