ggplot报错 stat_count() can only have an x or y aesthetic
在使用ggplot画柱状图的时候,发生了报错:tat_count() can only have an x or y aesthetic.
#画图用的矩阵
> b3name mean lcl95 ucl95 p_valueCT 0.8882961 0.2329421 1.54365 0.02816491
ref gap 1 1 1 0
#代码如下
> p <- ggplot(b3, aes(x=name,y=mean))
> p+geom_bar()
Error in `f()`:
! stat_count() can only have an x or y aesthetic.
Run `rlang::last_error()` to see where the error occurred.
> #按照提示查看处理办法
> #看不懂,bing一下
To deal with Error: stat_count() can only have an x or y aesthetic, we need to pass the stat=“identity” argument inside geom_bar function. Since we do not pass the count for bars and a bar graph can only contain only count variable, hence stat=“identity” is needed so that geom_bar considers only one variable in aes for counting. Check out the below example to understand the difference.
要传递 **stat=“identity”**这个参数
> p <- ggplot(b3, aes(x=name,y=mean))
> p+geom_bar(stat = "identity")
> #成功!
ggplot报错 stat_count() can only have an x or y aesthetic相关推荐
- stat_count() must not be used with a y aesthetic
stat_count() must not be used with a y aesthetic 目录 stat_count() must not be used with a y aesthetic ...
- Error: stat_count() can only have an x or y aesthetic Run `rlang::last_error()` to see where the err
Error: stat_count() can only have an x or y aesthetic Run `rlang::last_error()` to see where the err ...
- 【解决报错原因分析】画图plt.contourf(X,Y,Z)报错TypeError: unhashable type: ‘numpy.ndarray‘(含详细示例讲解)
今天简化画图代码的时候发现了很奇怪的报错现象,经过一系列尝试找到了根源,希望帮助后来人,主要问题出现在如下语句中(为了体现问题.方便比对,特意在这改变了x为xx,如果你不想看这冗长的示例,可以直接按照 ...
- 【报错】date: invalid date ‘2 days ago+%Y%m%d‘
1.问题: linux显示日期报错 2.原因:空格问题 '2 days ago' 和+之间要用空格隔开 3.解决方法: date1=$(date --date='2 days ago' +%Y%m%d ...
- latex安装报错 open(>C:\Users\oú\x{00bb}Yó¢\AppData\Local\Temp\vA07pSv3wO\1PybXiVx2Z/a2ping.win32.r15404.
[求助]Texlive镜像安装失败[latex吧]_百度贴吧 手贱起中文名,眼泪都要掉下来了
- python def函数报错详解_JSer 快速入门 Python 之函数详解
前一篇文章,用一天的时间,通过与 JavaScript 做对比的方式,快速领略了 Python 全貌. 梳理了那么多,若忽略细节差异,两门语言只有两个重要差异: 1.书写风格上大相同 2.功能覆盖上, ...
- 【报错解决01】分层抽样报错ValueError: The least populated class in y has only 1 member
以下程序解决的是python分层抽样问题,采用的数据集是一些股票的开盘价最高价等14个变量的信息. 根据网上的参考我的代码是这样的: from sklearn.model_selection impo ...
- oracle19c修改sys密码报错OPW-00029
19c 修改sys密码使用orapwd命令,报错OPW-00029 orapwd file='+DATA' dbuniquename=orcl sys=y password='passwd' forc ...
- 编译内核报错Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-deve
报错: Cannot generate ORC metadata for CONFIG_UNWINDER_ORC=y, please install libelf-dev, libelf-devel ...
最新文章
- 如何借助高考热点,微信公众号两天疯狂引流2万+
- Win10 无需安装虚拟机/双系统使用 linux
- 暑假N天乐【比赛篇】 —— 2019杭电暑期多校训练营(第四场)
- docker部署nginx并且挂载文件夹和文件
- 在python中如何有效的比较两个无序的列表是否包含完全同样的元素(不是set)?
- MongoDB 分片
- 如何应对数据匮乏,试试冷启动阶段开发的风险评分
- 在Ubuntu 18.04上安装PostgreSQL 11和PgAdmin4
- ftp服务器通信协议设计,基于FTP协议的文件传输服务器的研究
- java的三大特征:封装,继承和多态
- FFMPEG:MP4封装格式中外挂字幕的提取
- 玩转openpyxl,用python制作一个公司租车记录登记表!
- python 面试真题
- 当编程语言都变成女孩子
- 简单易懂的方式去看C语言精华--指针
- 原始数据哪里找?这些网站要用好!200个国内外数据网站大全
- 通常环境光照度参照表
- AES 对称加密算法
- 什么是序列化,怎么序列化,为什么序列化,反序列化会遇到什么问题,如何解决。
- 一些用前缀思想解决的题(持续完善)