How to order rows in a dot plot with ggplot2
0
0
Entering edit mode
4.9 years ago
francesca3 ▴ 160

Hi I want to obtain a graph like the one in the link (https://i.stack.imgur.com/qfEYh.png) using ggplot2 but I want to order the rows, showing first the ones in which the circle is present for all the three groups (the groups are the .

I wrote this command for my data

ggplot(subset(dataframe, FDR <0.25), aes(x=Type, y=NAME, color=Type)) + geom_point()

where I put the threshold to show the circle only if FDR < 0.25

I want to be shown in the y axis first the NAMES which have the circle present for all 3 conditions.

Thank you in advance for the help

RNA-Seq • 1.9k views
ADD COMMENT
0
Entering edit mode

Try this before plotting:

test <- test[order(as.numeric(factor(test$NAME))),]
test$NAME <- factor(test$NAME, levels=rev(unique(test$NAME)))
ADD REPLY
0
Entering edit mode

Thanks, I tried but in this way it orders the NAME just in alphabetic order.

ADD REPLY

Login before adding your answer.

Traffic: 1935 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6