I have a lapply function that applies my graphing function to each element within the list of qList (each element is a data table). Each element also already is the name of the disease.
volcanoList <- lapply(unique(qList),
function(x) volcanoGraph(x))
The volcanoGraph function is the following standard ggplot function:
volcanoGraph <- function(dataSetOrdered) {
ggplot(dataSetOrdered) +
geom_point(aes(x=MeanDiff, y=-log10(qColumn), colour=threshold)) +
geom_text_repel(aes(x = MeanDiff, y = -log10(qColumn), label=
ifelse(geneLabels %in% 1:10 == T | minDiff %in% 1:10 == T | maxDiff %in%
1:10 == T, geneMutCount,""))) +
xlab("WT - Mutation Mean Difference") +
ylab("-log10 adjusted q-value") +
#scale_y_continuous(limits = c(0,50)) +
theme(legend.position = "none",
plot.title = element_text(size = rel(1.5), hjust = 0.5),
axis.title = element_text(size = rel(1.25)))
}
As of right now, there is no ggtitle attached to it, since I don't know how to make titles for each element based on its corresponding disease (based on the element name). As an expected output, I wanted to label the title for each graph with: "Graph of (insert element name here)".