reorder data in ggplot

前端 未结 1 1399
野性不改
野性不改 2021-01-15 02:50

New and stuck with ggplot:

I have the following data:

tribe   rho preference_watermass
1   Luna2   -1.000  hypolimnic
2   OP10I-A1    -1.000  epilimn         


        
1条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-15 03:53

    You have to reorder the data itself, not just within aes, as correctly stated by @amzu:

    dfm$tribe <- reorder(dfm$tribe, dfm$rho)
    plot2
    

    enter image description here

    0 讨论(0)
提交回复
热议问题