0

I am trying to get a bar chart with parties' EU score on x and the percentage of votes each party got on y. The variable Vote_survey is already aggregated power votes. Here is my code:

ExpertSurvey=read_excel("Expert Survey.xlsx")
ggplot(ExpertSurvey)+
  geom_bar(aes(x=ExpertSurvey$"EU_score", y=ExpertSurvey$"Vote_survey"), stat = "identity")

For some reason, I am getting a a plot with no bars... Where could I be making a mistake here?

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
Sofiya
  • 1
  • try aes(x=EU_score,y=Vote_survey) – StupidWolf Nov 07 '19 at 00:24
  • 2
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Nov 07 '19 at 02:46
  • 1
    @StupidWolf I think the OP may benefit from an explanation why you have suggested this:) Sofiya - this was suggested because one does not need and actually should not use `$` within the `aes` call. – tjebo Nov 07 '19 at 08:24
  • Hi Sofiya, I actually simulated data and your code, and it should still work. Can you provide an example of the file? I think it's something weird about your data frame ExpertSurvey. Thanks @Tjebo for explaining why the $ inside aes is not needed and sorry I missed out on explaining. – StupidWolf Nov 07 '19 at 09:12

0 Answers0