Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/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 在ggplot中创建并排条形图_R_Ggplot2_Bar Chart - Fatal编程技术网

R 在ggplot中创建并排条形图

R 在ggplot中创建并排条形图,r,ggplot2,bar-chart,R,Ggplot2,Bar Chart,我试图从数据框的这个子集创建一个并排的条形图 ExitVelocityAverage Name CombinedAvgEV PlayerAvgEV <chr> <dbl> <dbl> 1 Adam Harrison 85.9 80.8 任何帮助都将不胜感激。例如,ggplot(ExitVelocityAverage)+geom_col(aes(姓名、玩家平均

我试图从数据框的这个子集创建一个并排的条形图

ExitVelocityAverage

 Name          CombinedAvgEV PlayerAvgEV
  <chr>                 <dbl>       <dbl>
1 Adam Harrison          85.9        80.8

任何帮助都将不胜感激。

例如,
ggplot(ExitVelocityAverage)+geom_col(aes(姓名、玩家平均数))+geom_col(aes('League average',CombinedAvgEV))
只能在没有a的情况下进行猜测,但您可能需要将数据重塑为ggplot希望使用的长格式,然后使用一个变量来设置颜色非常感谢!!
ggplot(ExitVelocityAverage, aes(x=Name))
  geom_bar(aes(x = Name,y=PlayerAvgEV), col = "red", fill = "red", stat="identity") +
  geom_bar(aes(x = Name,y=CombinedAvgEV), col = "blue", fill = "blue", stat="identity")