kevinblighe / EnhancedVolcano

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

maplot and volcano same image #87

Closed Maarten-vd-Sande closed 2 years ago

Maarten-vd-Sande commented 2 years ago

I'm trying to put your volcano plot and the deseq ma plot on the same figure. However I can't seem to get it to work. I'm relatively inexperienced with R, so I might be approaching this all wrong though :see_no_evil:

When I try with par enhancedvolcano takes over the whole figure, and seems not to respect that setting:

png("mypng.png", width = 465, height = 225, units='mm', res = 300)
par(mfrow=c(1,2))

DESeq2::plotMA(
  res,
  alpha = fdr,
  ylab = 'log2 fold change',
)

EnhancedVolcano::EnhancedVolcano(resLFC,
    lab = rownames(res),
    x = 'log2FoldChange',
    y = 'pvalue',
)

I can't get it working with gridExtra::grid.arrange since the plotMA function does not return the grob. How would I get these plots next to each other in a single image?

kevinblighe commented 2 years ago

Hi! Have you tried to use ggplotify::as.grob() on the MA plot? Another one to try is cowplot::plot_grid() directly on these objects.

Maarten-vd-Sande commented 2 years ago

Thanks for your reply. The issue is that it seems that DESeq2::plotMA does not return anything, so I'm not sure how I can try to get it as.grob or into the plot_grid.

I'm not really sure if this is an deseq/geneplotter issue (as plotMA does not seem to return the plot) or a enhancedvolcano issue as it does not respect par.. :thinking:

kevinblighe commented 2 years ago

Yep, anything based on ggplot2, like EnhancedVolcano, does not quite respect par().

Another function to try on plotMA() is https://rdrr.io/cran/cowplot/man/as_grob.html

If all else fails, you can use EnhancedVolcano to generate an MA plot: https://www.biostars.org/p/457769/

https://i.ibb.co/rtQCPbx/hh.png

Maarten-vd-Sande commented 2 years ago

Since the plotMA never returns anything I don't know how to pass that to the as_grob function. I'll go with the EnhancedMA way, since it's prettier than the deseq ma plot anyways :smile:

Thanks so much for answering my question

kevinblighe commented 2 years ago

Thanks, yes, the plotMA() function seems to behave in a strange way. I tried but failed to capture the output.