Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R ggplot2获取;错误:美学长度必须为1,或与数据问题长度相同;_R_Ggplot2 - Fatal编程技术网

R ggplot2获取;错误:美学长度必须为1,或与数据问题长度相同;

R ggplot2获取;错误:美学长度必须为1,或与数据问题长度相同;,r,ggplot2,R,Ggplot2,我犯了一个错误 Error: Aesthetics must either be length one, or the same length as the dataProblems:Average, Average, Average 尝试在具有多个水平箱线图的图片中放置垂直线 这是一个data.frame gs1_域,用于绘制箱线图 这是data.frame R_18,用于在绘图中放置垂直线 下面是我绘制箱线图的代码 bp_domain <- ggplot(gs1_domain,

我犯了一个错误

Error: Aesthetics must either be length one, or the same length as the dataProblems:Average, Average, Average
尝试在具有多个水平箱线图的图片中放置垂直线

这是一个data.frame gs1_域,用于绘制箱线图

这是data.frame R_18,用于在绘图中放置垂直线

下面是我绘制箱线图的代码

bp_domain <- ggplot(gs1_domain, aes(x=gs1_domain$Domain, y=gs1_domain$Average))
bp_domain + stat_boxplot(geom='errorbar') + geom_boxplot(outlier.shape = 1) + 
  coord_flip() + xlab("Domínio") + ylab("Média") + ggtitle("Box plot das médias por domínios")
但我得到了那个错误信息。 我已经从gs1\U域中删除了NA

有人能告诉我出了什么问题吗?

试着更换

aes(x=gs1_domain$Domain, y=gs1_domain$Average)


数据框已经指定,我们只需要在
aes

中指定列名。不要显示数据的图片,而是使用
dput
在您的问题中包含(一些)数据。
aes(x=gs1_domain$Domain, y=gs1_domain$Average)
aes(x=Domain, y=Average)