This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Enhanced volcano: how to control the size, and to plot multiple volcanos to one PDF page?

I am trying to plot multiple volcano plots to the same PDF page with the following code. However, instead I get a PDF file with multiple pages, one plot on each. Also pdf('volcanos.pdf', width = 10, height = 10) controls for the size of each page but not the plot itself. How to control for the size of each volcano plot, and to plot many of them on the same page? data = my dataframe with datasets from volcano plots

for(i in 1:(ncol(data)/2)) {
  pdf(paste0('./volcano_', gsub('log2FC', '', colnames(data)[2*i-1]), '.pdf'))
  volcano <- EnhancedVolcano(data,
                  lab = rownames(data),
                  title = gsub('log2FC_', '', colnames(data)[2*i-1]),
                  x = colnames(data)[2*i-1],
                  y = colnames(data)[2*i],
                  ylab = bquote(~-Log[10]~adjusted~italic(P))
                  xlim = c(-2, 2),
                  pCutoff = 0.05,
                  FCcutoff = 0.5,
                  transcriptLabSize = 5,
                  drawConnectors = TRUE,
                  widthConnectors = 0.2,
                  legendPosition = 'right')
  print(volcano)
  dev.off()
  }
r plotting

1 answer

Hey, there is an example in the vignette: 4.10 Over-ride colouring scheme with custom key-value pairs.

download

Kevin

Log in to answer this question.