I have some expression data and I am interested in making some individual plots per gene. To make this plot:
I used this code:
ggplot(geneOfInterestmelt, aes(x=variable, y=value, fill=fill, colour = fill)) +
geom_dotplot(binaxis='y', stackdir='center', dotsize=0.5)+
scale_fill_manual(values = c("seagreen3", "steelblue"))+
scale_colour_manual(values = c("seagreen3", "steelblue"))+
xlab("")+
ylab("Counts per million (CPM)")+
theme(axis.title.y = element_text(face = "bold"),
legend.text = element_text(face = "bold"),
axis.text.x = element_text(face = "bold", colour ="black"),
axis.text.y = element_text(face = "bold", colour ="black"),
axis.title.x = element_text(face = "bold", colour = "black"),
legend.title = element_text(face = "bold"),
panel.grid.major = element_line(size = 0.25, linetype = 'dashed',
colour = "grey"),
panel.grid.minor = element_line(size = 0.25, linetype = 'dashed',
colour = "grey"),
panel.background = element_blank(),
axis.line = element_line(colour = "black"),
plot.title = element_text(face = "bold", size = 10, hjust = 0.5))+
theme(legend.position = "none")+
stat_summary(fun.y = mean, fun.ymin = mean, fun.ymax = mean,
geom = "crossbar", width = 0.15, colour=c("seagreen3","steelblue"))
What i want to add in the corner is all stored in a data frame so i can add code to call it, I basically want the geneId, with the logFC underneath, and the adjusted p value under that. All of this in the top right hand corner. Like say, this is all contained within a dataframe that accompanies the data, with the idea that this code can be used to make these reproducible graphs just by switching out the gene name.
I seen some people use annotate() to add this, but unless im not mistaken (which i could be cus im new), annotate needs to be mapped. And since each gene has different expression levels the mapping cant therefore be the same in each gene.
Is this possible?
Thanks in advance!