0

I want Depth interval 1 on top and Depth interval 4 on bottom. I have tried coord_flip() and scale_y_reverse(). scale_x_reverse() cannot be performed because "Error: Discrete value supplied to continuous scale". I tried scale_x_discrete() and changing Depth from factor to numeric. It seems so easy but I am having such a difficult time:

enter image description here enter image description here

Tung
  • 26,371
  • 7
  • 91
  • 115
  • Welcome to Stack Overflow! Could you make your problem reproducible by sharing a sample of your data so others can help (please do not use `str()`, `head()` or screenshot)? You can use the [`reprex`](https://reprex.tidyverse.org/articles/articles/magic-reprex.html) and [`datapasta`](https://cran.r-project.org/web/packages/datapasta/vignettes/how-to-datapasta.html) packages to assist you with that. See also [Help me Help you](https://speakerdeck.com/jennybc/reprex-help-me-help-you?slide=5) & [How to make a great R reproducible example?](https://stackoverflow.com/q/5963269) – Tung Mar 07 '20 at 00:28
  • 1
    Does this answer your question? [Reverse order of discrete y axis in ggplot2](https://stackoverflow.com/questions/28391850/reverse-order-of-discrete-y-axis-in-ggplot2) specifically, the second answer that tells you to reverse the order of the `Depth` factor, not the accepted one – Calum You Mar 07 '20 at 00:48
  • I ended up using x= reorder(Depth, desc(Depth)) in the ggplot call and then the figure coord_flip()’ed nicely after that. Thank you for all the help! – dupree99 Mar 08 '20 at 01:36

0 Answers0