kevinblighe / EnhancedVolcano

Publication-ready volcano plots with enhanced colouring and labeling
399 stars 81 forks source link

Add option for dropping unused factors from legend #48

Closed eturkes closed 4 years ago

eturkes commented 4 years ago

Hi Kevin,

Thanks for this nice package. While using it I noticed that unused factor levels are removed from the legend and I couldn't toggle this. This commit adds that feature. I've attached a screenshot showing the result. As you can see, nothing passes the p-value threshold alone, but with the new option, we can still have it appear in the legend. I also updated the roxygen documentation. If you have an qualms about the way I implemented it but would still like to add the feature, feel free to close this and add it how you like. I haven't tested it much.

legendDropLevels

Below are the details from my commit message:

In the original behavior, by default, unused factor levels are removed from the legend. This commit adds a logical option to toggle this behavior, with the default being the original behavior to drop levels. Some lines of code are also changed to use toptable$Sig rather than factor(Sig), as the original variable in my testing was empty and did not produce the desired result with the new option (though did not seem to produce bugs otherwise).

kevinblighe commented 4 years ago

Hey @eturkes , thank you for contributing! I will aim to take a look at this in the next couple of days

kevinblighe commented 4 years ago

Thanks very much for that @eturkes - I implemented the changes and nothing seems to have been affected. I wonder could you try to test it a bit more if you have time?

I have added you as contributor to the package as a result of having contributed code. Your name should appear here when the Bioconductor devel. branch is re-built: https://bioconductor.org/packages/devel/bioc/html/EnhancedVolcano.html

eturkes commented 4 years ago

Happy to hear it @kevinblighe and thanks for the attribution. Sure, I'll try to take a look in the coming week, particularly the several other conditionals where the code was changed. Let you know how it goes.