This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How can i change the position of the legend in a MAplot?

Hello, I am trying to do 6 different MAplots, each one of a different array, but I want that they appear together in one image. I use this command

ArraysName <- c("A", "B", "C", "D", "E", "F")
 par(mfrow= c(3,2))
        for (i in 1:6) {
            plotMA(data, array= i, cex = 0.2, ,ArraysName [i] ))
  }

And it works perfectly, but in the image the legend of each array is very big and it covers part of the data. How can I change the position of the legend or make the legend smaller so that it doesn't cover the array?

maplot

Thank you so much! It worked!

1 answer

use legend = in your function plotMA. For example:

MA <- new("MAList")
MA$A <- runif(300,4,16)
MA$M <- rt(300,df=3)

# Spike-in values
MA$M[1:3] <- 0
MA$M[4:6] <- 3
MA$M[7:9] <- -3

status <- rep("Gene",300)
status[1:3] <- "M=0"
status[4:6] <- "M=3"
status[7:9] <- "M=-3"
values <- c("M=0","M=3","M=-3")
col <- c("blue","red","green")
plotMA(MA,main="MA-Plot with 12 spiked-in points",
       status=status, values=values, hl.col=col, legend = "topleft")

plotMA(MA,main="MA-Plot with 12 spiked-in points",
       status=status, values=values, hl.col=col, legend = "bottomleft")

plotMA(MA,main="MA-Plot with 12 spiked-in points",
       status=status, values=values, hl.col=col, legend = "topright")

plotMA(MA,main="MA-Plot with 12 spiked-in points",
       status=status, values=values, hl.col=col, legend = "bottomright")

Log in to answer this question.