It's quite possible to do what you want. The base plot functions in R make overplotting easy (adding sets of points to a plot layer by layer). If your data frames are in a list, you can use the apply family of functions. Here's a not pretty example using mapply() which can iterate through two things at once (a list of data frames, and a vector of colors).
df_list <- lapply(as.list(1:5), function(x){
x <- rnorm(50) + rnorm(1,0,2)
y <- abs(rnorm(50))
df <- data.frame(ex=x, sig=y)
rownames(df) <- paste0("g",1:50)
return(df)
})
plot(1,1, type="n", xlim=c(-4,4), ylim=c(0,3), xlab="logFC", ylab="sig")
plotcolors <- rainbow(5)
mapply(function(df,p){
points(df$ex, df$sig, col=p, pch=19)
}, df_list, plotcolors)
The first section uses apply to create a list of 5 dataframes, each with 2 columns containing 50 data points vaguely resembling volcano plot-like data skewed in a given direction. In this case, each data frame has the same set of genes (but it doesn't matter what the gene names are). The second part uses mapply() to loop through the list of dataframes, and the vector of plot colors, to draw data points on the plot.
Of course, if you had a few data frames and wanted to simply plot them one by one (no loop), it's straightforward:
plot(logFC, significance, col="grey")
points(df1$logFC, df1$significance, col=yourFavoriteColor1)
points(df2$logFC, df2$significance, col=yourFavoriteColor2)
Hi, thank you for the answer, this is exactly what I was looking for. For a better visualization, is it possible to use it in ggplot?
Yes, ggplot is possible, but then you have the perpetual riddle of getting the data into the right arrangement for ggplot, as @MingTang mentions. Which is just a different kind of problem. My brain doesn't solve those naturally without going for a walk. But I'm sure it's easy for some people here.