Suppose you have datasets A and B as a data.frame:
A <- data.frame(x=1:5, y=11:15)
B <- data.frame(x=1:10, y=20:11)
You have to join them together:
df <- rbind(A, B) # Join A and B together.
df
x y
1 1 11
2 2 12
3 3 13
4 4 14
5 5 15
6 1 20
7 2 19
8 3 18
9 4 17
10 5 16
11 6 15
12 7 14
13 8 13
14 9 12
15 10 11
Then you can plot it:
ggplot(data=df, aes(x=x, y=y)) + geom_point()
If you want to distinguish points from dataset A and B by color:
df$dataset <- c(rep("A", nrow(A)), rep("B", nrow(B)))
df
x y dataset
1 1 11 A
2 2 12 A
3 3 13 A
4 4 14 A
5 5 15 A
6 1 20 B
7 2 19 B
8 3 18 B
9 4 17 B
10 5 16 B
11 6 15 B
12 7 14 B
13 8 13 B
14 9 12 B
15 10 11 B
ggplot(data=df, aes(x=x, y=y, col=dataset)) + geom_point()
If you want to distinguish points from dataset A and B by color and size and change axis labels:
ggplot(data=df, aes(x=x, y=y, col=dataset, size=dataset)) + geom_point() +
scale_color_manual(name="Dataset", labels = c("Data A","Data B"), values=c("red", "blue")) +
scale_size_manual(name="Dataset", labels = c("Data A","Data B"), values=c(10, 5)) +
xlab("xxxx") + ylab("yyyy")
See Tutorial or use google :).