异常:Error: Aesthetics must either be length one, or the same length as the dataProblems:AData

今天遇到一个异常,代码如下:

set.seed(12345)
require(ggplot2)
AData <- data.frame(Glabel=LETTERS[1:7], A=rnorm(7, mean = 0, sd = 1), B=rnorm(7, mean = 0, sd = 1))
i <- 2
j <- 3
p <- ggplot(data=AData, aes(AData[, i], AData[, j])) + geom_point() + theme_bw()p # all right
p <- p + geom_text(aes(data=AData, label=Glabel), size=3, vjust=1.25, colour="black")p # Error: Aesthetics must either be length one, or the same length as the dataProblems:AData

下面的代码就ok:
example <- data.frame(r=c(5,4,3),theta=c(0.9,1.1,0.6))myplot <- ggplot(example, aes(r, theta)) + geom_point(size=3.5) +geom_text(aes(label=rownames(example)), size=4.4, hjust=0.5, vjust=-1)

根据异常信息,应该是说Glabel与AData的长度不同,但具体什么原因不了解。

stackover上面的解释是:对于0.9.0版本的ggplot2有这个问题,0.9.1版本中已经解决。(http://stackoverflow.com/questions/10628847/geom-boxplot-with-precomputed-values)

利用installed.packages()命令,看到我的ggplot2的版本是1.0.1,应该没有问题,奇怪。

stackoverflow上另外一个类似的帖子是:http://stackoverflow.com/questions/20057452/aesthetics-must-either-be-length-one-or-the-same-length-as-the-dataproblems

但是与我遇到的问题不大一样,暂无解.
 
时间: 2024-08-10 21:22:50

异常:Error: Aesthetics must either be length one, or the same length as the dataProblems:AData的相关文章

Hibernate 异常 : Error parsing JNDI name [xxx]

初学 Hibernate ,用官方给的日志模板配置好了日志,跑起小例子, 控制台中的日志里写了一些异常: 21:16:36,036 DEBUG EntityLoader:146 -  Static select for entity cn.sjll.hibernate435.model.UserModel  [OPTIMISTIC_FORCE_INCREMENT]: select usermodel0_.ID as ID1_0_0_,  usermodel0_.NAME as NAME2_0_0

Mac下Mysql启动异常[&quot;ERROR 2002 (HY000): Can&#39;t connect to local MySQL server through socket &#39;/tmp/mysql.sock&#39; (2)&quot;]

在mac下使用brew安装mysql,之前没有使用过,今天启动的时候发现启动不了 huijundeMacBook-Pro:bin huijunzhang$ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) 查看mysql的安装位置: huijundeMacBook-Pro:bin huijunzhang$ which mysql /usr/local

ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes

今天在MySQL 5.6版本的数据库中修改InnoDB表字段长度时遇到了"ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes"错误,第一次遇到这个错误,遂花了点学习.研究过.总结这个问题. 我们先来创建一个测试表,构造这样的错误. mysql> use MyDB; Reading table information for completion of table and colum

Spring 异常:Error creating bean with name

异常信息:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxx' 我今天出先次错误的原因是修改了实体信息的属性,而属性名与继承的based实体里面的属性名相同所以启动报错.如果实体类没有加@Entity dao层 @Repository  service层  @Service 也会报次错.

C++ win32 dll 引用外部CLR,加载托管程序集异常-Error 10 error LNK2019: unresolved external symbol _CLRCreateInstancet

异常: Error 10 error LNK2019: unresolved external symbol [email protected] referenced in function "unsigned long __stdcall StartTheDotNetRuntime(void *)" ([email protected]@[email protected]) E:\C++\VC项目\NativeDll\NativeDll.obj NativeDll 解决措施: nat

记一次Jenkins 打包异常 ERROR: Exception when publishing, exception message [Failure]

今天早上打包一直都没有问题,突然有一次打包突然出现异常现象,如下: ERROR: Exception when publishing, exception message [Failure] Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE 我很好奇,服务器启动日志没有报错,Jenkins上的配置信息也没有去动它,为什么会出现这种异常呢,于是,我看了下那台机器上的磁盘存储情况

mysql异常ERROR 1055 (42000)说明

具体异常信息如下: ERROR 1055 (42000): Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'aaa.test.age' which is not functionally dependent on columns in GROUP BY clause;  this is incompatible with sql_mode=only_full_gro

mysql 导出数据到文件数据异常 ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement

ERROR 1290 (HY000): The MySQL server is running with the --secure-file-priv option so it cannot execute this statement 首先输入下面下面命令查看 show global variables like '%secure%'; 查询secure_file_priv 我的当时为null所以要修改: 修改方法:

mybatis查询异常-Error querying database. Cause: java.lang.ClassCastException: org.apache.ibatis.executor.ExecutionPlaceholder cannot be cast to java.util.List

背景,mybatis查询的时候直接取的sqlsession,没有包装成SqlSessionTemplate,没有走spring提供的代理. 然后我写的获取sqlsession的代码没有考虑到并发的情况,导致sqlsession建的太多 并发大了之后,查询报错 org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.lang.ClassCastException: org