0

I am trying to create a side by side bar chart from this subset of a data frame

ExitVelocityAverage

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

Ultimately I would have one barchart that has Adam's Average (PlayerAvgEV) and another barchart that shows the total average of the data frame (CombinedAvgEV). Ideally these barcharts would be side by side and this would show that Adam is below the average.

This is where I am at but it isn't working

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") 

Any help would be greatly appreciated.

elehr22
  • 11
  • e.g. `ggplot(ExitVelocityAverage) + geom_col(aes(Name, PlayerAvgEV)) + geom_col(aes('League average', CombinedAvgEV))` – Axeman Nov 05 '19 at 18:46
  • Can only guess without a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example), but you probably need to reshape your data into the long format that ggplot expects to work with, then use a variable for setting color – camille Nov 05 '19 at 19:03
  • Thank you so much!! – elehr22 Nov 05 '19 at 21:59

0 Answers0