Avoid ggplot sorting the x-axis while plotting geom_bar()

前端 未结 4 733
情书的邮戳
情书的邮戳 2020-11-28 06:32

I have the following data which I want to plot with ggplot:

SC_LTSL_BM    16.8275
SC_STSL_BM    17.3914
proB_FrBC_FL   122.1580
preB_FrD_FL    18.5051
B_Fo_S         


        
4条回答
  •  误落风尘
    2020-11-28 06:59

    You can also just re-order the corresponding factor as described here

    x$name <- factor(x$name, levels = x$name[order(x$val)])
    

提交回复
热议问题