Reordering legend labels and changing arrow length in Enhanced Volcano
1
1
Entering edit mode
3.8 years ago

Hi all, I am very new to R, and I made a volcano plot using enhancedVolcano. It all looks nice, the only problems are:

1) After overriding the color of the points to different groups, it automatically creates the legend and sorts it alphabetically, which I don't want. I tried reordering using legendLabels, and overriding using scale_fill_discrete, but didn't work.

2) I am trying also to make the connectors longer, because some of the points are pretty dense, and are overlapping. But lengthConnectors only changed the arrowhead size, and not the arrow length.

If someone had this problem and found a solution, that would be great!

R enhanced volcano enhancedvolcano • 3.1k views
ADD COMMENT
2
Entering edit mode
3.8 years ago

Hey David,

For the length of the connectors, you need to modify:

lengthConnectors = unit(0.01, 'npc')

For re-ordering after having used colCustom, that's a very specific level of functionality and I would encourage you to modify it manually after you generate the plot. Otherwise, create a GitHub issue at https://github.com/kevinblighe/EnhancedVolcano/issues

Kevin

ADD COMMENT
0
Entering edit mode

Hi Kevin,

I'm running into the same thing as David regarding the order of the legend labels. Do you have any guidance as to how to modify that manually as you suggested? Is there a recommended R or ggplot way of going about that? What I've read so far talks about re-ordering the levels of a df factor but I don't think that applies in this case since the colors are coming from a key-val pairing. Or did you mean more along the lines of modifying the legend in an image editing software after exporting the plot?

ADD REPLY
1
Entering edit mode

Hi, I cannot recall. If changing the order of the key-value pairs does not work, then you may very well have to manually re-order the legend in, e.g., MS Paint.

ADD REPLY

Login before adding your answer.

Traffic: 1914 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