1

I searched very intensively, but could not find a solution to my problem.

I want to get the data in my graph ordered by values so that Tussilago farfara comes first and Euphorbia cyparissias comes last.

This is my dataset:

enter image description here

This is the code I used:

ggplot(data = artSlope, aes(x = slope, y = art)) +
    geom_point() + 
    theme(panel.grid.major = element_blank(), 
            panel.grid.minor = element_blank(), 
            panel.background = element_blank(), 
            axis.line = element_line(colour = "black")) + 
    labs(y = "species", title = "phenological shifts") +  
    geom_vline(xintercept = 0) + 
    geom_errorbarh(aes(xmax = slope + se, xmin = slope - se))

And this is the result I get: enter image description here

How do I get the graph ordered by slope (x axis)?

demongolem
  • 9,474
  • 36
  • 90
  • 105
Miri
  • 11
  • 1
  • check out http://rstudio-pubs-static.s3.amazonaws.com/7433_4537ea5073dc4162950abb715f513469.html – timfaber May 22 '17 at 11:29
  • 4
    `aes(slope, forcats::fct_reorder(art, -slope))`. – Axeman May 22 '17 at 11:36
  • 1
    Good question. A helpful addition would be to include the data set, not by a graphic, but by using `dput(artSlope)` and pasting the result into the question. This will allow others to easily [reproduce](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) the example. That said, @Axeman 's comment above should produce the graphic you are looking for. – Peter May 22 '17 at 12:07

0 Answers0