How can I descending reorder the dots in the scatter plot in ggplot based on the X values?

Viewed 12

I am stuck at one trick in ggplot in R: I am trying to plot a scatter plot for metabolites (y axis) based on their VIP score (X axis) here is the data Data, but when I run this in ggplot, it produced non-ordered scattering of the points as you can see here Produced graph I would like to plot the same figure but with the dots being descending order from high to low similar to this one wished Figure

I have tried using reorder but could not get my head around it. Here is my script

ggplot(VIP, aes(x= `Mean decrease in model accuracy`, y = Metabolites, color = Class)) + geom_point(size = 3)

Highly appreciating for any help

Thanks

0 Answers
Related