I currently have a code to make a scatterplot as shown below, I made two objects of gene names that are being downregulated and upregulated, Then I added the two objects to points (points = c(genes.to.labelCtrl, genes.to.labelCis
)) so that only the labels in these two objects show up on the scatterplot. But I would like the genes.to.labelCtrl
gene names to be blue in color and genes.to.labelCis
gene names to be red in color. But I can't add more than one color to the LabelPoints
, otherwise the code throws me an error.
p1 <- ggplot(object, aes(CTRL, CIS)) + geom_point() + ggtitle("Macrophage CTRL vs CIS") + theme(plot.title = element_text(hjust = 0.5)) + geom_point(size = 1,alpha = 0.6) +
geom_smooth(method=lm, se=TRUE, color="brown", linetype="solid", size=1)
p1 <- LabelPoints(plot = p1, points = c(genes.to.labelCtrl, genes.to.labelCis), color="blue", repel = TRUE, xnudge=0, ynudge=0)
plot_grid(p1)
Do you know how to overcome this issue?