0

I am facing an issue with the scales option of facet_wrap. I have ploted several geom_bar in R (see below). For Watching and Grooming behaviours, the y axis is not in the right order : it should be from down to up 7.8 - 10.2 - 11.0 while it appears as 10.2 - 11.0 - 7.8. How can I fix this?

Here's my code:

enter image description here

enter image description here

Nimantha
  • 6,405
  • 6
  • 28
  • 69
  • 1
    Hi and welcome. Please have a look at: [https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example](How to make a great r reproducible example) and also post the code in a `codeblock` and not with a screenshot. Thank you. – Marco_CH Jan 14 '22 at 10:45
  • 1
    ... from the image of your plot I would guess that the variable mapped on `y` is a character (or factor). That's why in some cases the "values" are ordered alphabetically. Hence I would have a look at the data and try with converting to a numeric. – stefan Jan 14 '22 at 10:48
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jan 22 '22 at 19:07

0 Answers0