library(ggplot2)
library(grid)
library(gridExtra)
df = read.csv("NEK7_BRCA.csv", sep = , header = TRUE)
head(df)
## NEK7 UNC45A NR3C1
## 1 13.7725 10.1443 13.0158
## 2 12.7417 10.9407 12.7186
## 3 12.7267 10.9141 12.5933
## 4 12.6931 10.6454 12.5922
## 5 12.5557 11.0752 12.5727
## 6 12.5164 9.8912 13.0979
attach(df)
grob1 = grobTree(textGrob(paste("Pearson Correlation : ", round(cor(NEK7, UNC45A), 4) ), x = 0.63, y = 0.97, hjust = 0, gp = gpar(col = "red", fontsize = 11, fontface = "bold")))
grob2 = grobTree(textGrob(paste("Pearson Correlation : ", round(cor(UNC45A, NR3C1), 4) ), x = 0.63, y = 0.97, hjust = 0, gp = gpar(col = "red", fontsize = 11, fontface = "bold")))
grob3 = grobTree(textGrob(paste("Pearson Correlation : ", round(cor(NR3C1, NEK7), 4) ), x = 0.63, y = 0.97, hjust = 0, gp = gpar(col = "red", fontsize = 11, fontface = "bold")))
g1 = ggplot(df, aes(x=NEK7, y=UNC45A)) + geom_point() + ggtitle("NEK7 vs UNC45A") + geom_smooth(method=lm, se=FALSE) + scale_x_continuous(name = "NEK7", limits = c(5, 15), breaks = seq(5, 15, 2)) + scale_y_continuous(name = "UNC45A", limits = c(5,15), breaks = seq(5, 15, 2)) + annotation_custom(grob1) + theme(plot.title = element_text(hjust = 0.5))
g2 = ggplot(df, aes(x=UNC45A, y=NR3C1)) + geom_point() + ggtitle("UNC45A vs NR3C1") + geom_smooth(method=lm, se=FALSE) + scale_x_continuous(name = "UNC45A", limits = c(5, 15), breaks = seq(5, 15, 2)) + scale_y_continuous(name = "NR3C1", limits = c(5,15), breaks = seq(5, 15, 2)) + annotation_custom(grob2) + theme(plot.title = element_text(hjust = 0.5))
g3 = ggplot(df, aes(x=NR3C1, y=NEK7)) + geom_point() + ggtitle("NR3C1 vs NEK7") + geom_smooth(method=lm, se=FALSE) + scale_x_continuous(name = "NR3C1", limits = c(5, 15), breaks = seq(5, 15, 2)) + scale_y_continuous(name = "NEK7", limits = c(5,15), breaks = seq(5, 15, 2)) + annotation_custom(grob3) + theme(plot.title = element_text(hjust = 0.5))
grid.arrange(g1, g2, g3, nrow = 1, ncol = 3)

Scatter plot with/without grid
ggplot(df, aes(x=NR3C1, y=NEK7)) + geom_point() + ggtitle("NR3C1 vs NEK7") + geom_smooth(method=lm, se=FALSE) + scale_x_continuous(name = "NR3C1", limits = c(5, 15), breaks = seq(5, 15, 2)) + scale_y_continuous(name = "NEK7", limits = c(5,15), breaks = seq(5, 15, 2)) + annotation_custom(grob3) + theme(plot.title = element_text(hjust = 0.5), panel.background = element_blank(), axis.line = element_line(color="black"), axis.line.x = element_line(color="black"))

ggplot(df, aes(x=NEK7, y=UNC45A)) + geom_point() + ggtitle("NEK7 vs UNC45A") + geom_smooth(method=lm, se=FALSE) + scale_x_continuous(name = "NEK7", limits = c(5, 15), breaks = seq(5, 15, 2)) + scale_y_continuous(name = "UNC45A", limits = c(5,15), breaks = seq(5, 15, 2)) + annotation_custom(grob1) + theme(plot.title = element_text(hjust = 0.5), panel.background = element_blank(), axis.line = element_line(color="black"), axis.line.x = element_line(color="black")) + theme_bw()
