Entering edit mode
2.7 years ago
Dk
▴
20
Hello everyone, I am trying to plot the volcano plot along with geneID label on it. However, my code doesn't work so I don't know what did I do wrong here. Here are my code:
myTopHits.df.ordered <- myTopHits.df[order(myTopHits.df$adj.P.Val), ]
myTopHits.df.ordered$geneID <- rownames(myTopHits.df.ordered) %in% rownames(myTopHits.df.ordered[1:10,])
View(myTopHits.df.ordered)
#now plot
vplot <- ggplot(myTopHits.df.ordered) +
aes(y=-log10(adj.P.Val), x=logFC, text = paste("Symbol:", geneID)) +
geom_text_repel(aes(x = logFC, y = -log10(adj.P.Val), label = ifelse(geneID == TRUE, rownames(myTopHits.df.ordered),""))) +
geom_point(size=2) +
labs(title="Volcano plot",
subtitle = "Mus musculus") +
theme_bw()
ggplotly(vplot)
For the results, I got the volcano plot but no geneID label on it and got the error messages:
Warning message:
In geom2trace.default(dots[[1L]][[1L]], dots[[2L]][[1L]], dots[[3L]][[1L]]) :
geom_GeomTextRepel() has yet to be implemented in plotly.
If you'd like to see this geom implemented,
Please open an issue with your example code at
https://github.com/ropensci/plotly/issues
Please help me out! I really appreciate all your helps! Thank you!
Try this:
Hi, I tried it but I got the error messages:
Try
label
instead oftext
:Thank you so much for your help! But this time I got the message:
Warning message: ggrepel: 10001 unlabeled data points (too many overlaps). Consider increasing max.overlaps
so I tried the code:
vplot <- ggplot(myTopHits.df.ordered) + aes(y=-log10(adj.P.Val), x=logFC, label = paste("Symbol:", geneID)) + geom_label_repel() + geom_point(size=2) + labs(title="Volcano plot", subtitle = "Mus musculus") + theme_bw() vplot
but I still got the error message:
Error in UseMethod("depth") : no applicable method for 'depth' applied to an object of class "NULL"
So you got a warning not an error while running my code.
max.overlap
is an argument ingeom_text_repel
. try to increase its value and see what you can get. check also the other arguments like thepadding
argument, try also to increase it