1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
library(ggplot2)
A = data.frame(x = rnorm(10),y=rnorm(10))
B = data.frame(x = rnorm(10),y=rnorm(10))
scaleMin = min(c(min(A$x), min(B$y)))
scaleMax = max(c(max(A$x), max(B$y)))
both <- ggplot(A, aes(x,y)) +
geom_point(color='red') +
geom_point(data=B,colour='blue') +
geom_abline(intercept = 0, slope = 1, colour = "black") +
labs(title = "title", subtitle = "sub", x = "X", y="Y") +
xlim(c(scaleMin, scaleMax)) + ylim(c(scaleMin, scaleMax)) +
theme(
axis.title.x = element_text(face="plain", colour="black", size=14), axis.text.x = element_text(size=13),
axis.title.y = element_text(face="plain", colour="black", size=14), axis.text.y = element_text(size=13),
panel.grid.major = element_blank(), panel.grid.minor = element_blank(),
panel.background = element_rect(fill = "transparent"),
axis.line = element_line(colour = "black"),
panel.border = element_rect(colour = "black", fill=NA, size=0.5)
)
both |
Partager