I am drawing two scatter plots with labels in the same graph. I know how to do one scatter plot with label. But I am struggling to overlay another scatter plots with labels but the each dot is the pair of the first scatter plot. In this case, can you help me how to do? I did as below, but this does not work....
library("ggplot2")
library("ggrepel")
df <- read.table("a.txt", , row.names = 1, header=T)
AF_2 Beta_2 AF Beta
1 0.30 -0.35 0.01 -0.35
2 0.50 0.05 0.23 0.24
3 0.60 0.05 0.46 0.02
4 0.20 0.39 0.24 0.24
5 0.01 -0.28 0.54 -0.45
6 0.20 -0.01 0.24 -0.04
ggplot(df, aes(x = AF, y = Beta), label = rownames(df)) +
xlab("Allele frequency") + ylab("Beta") +
ylim(-0.5, 1) +
geom_point() +
geom_label_repel(aes(label = rownames(df))) +
geom_point(aes(x = AF_2, y = Beta, color = "red"))
Thank you in advance!
*** I edited my codes above, thanks to the suggestions by @r2evans