Last active
October 27, 2018 19:20
-
-
Save timedreamer/70e74982d8fb93e675fd0f63cbb7140a to your computer and use it in GitHub Desktop.
Short R script to plot 18 Arabidopsis ecotypes location on map.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Plot 18 arabidopsis ecotypes' locations on map. | |
## Author: Ji Huang | |
## Date: 2018-10-25 | |
# The longitude and latitude info is provided by Chia-Yi on "EighteenAccession" | |
# in the email. I changed two locations for the obvious wrong location. | |
library(ggmap) | |
library(ggrepel) | |
world <- map_data("world", wrap = c(-180, 180, NA), ylim = c(-60,90)) | |
gg1 <- ggplot() + geom_polygon(data = world, aes(x=long, y = lat, group = group), fill = "grey") + | |
coord_fixed(1.3) | |
labs <- data.frame( | |
long = c(140.1, 11.35, -6.2, -92.3, 15, -3.16, 6.14, 23.89, 21.01, 14.77, 22.46, 34.02, 6.13, | |
139.83, 68.79, 18.06, 36.92, 136.5), | |
lat = c(39.77, 44.5, 54.1, 38.3, 37.3, 55.95, 46.21, 54.9, 52.24, 37.17, 32.34, 62.13, 60.23, | |
38.94, 38.59, 59.34, 52.84, 34.73), | |
names = c("Akita", "Bl-1", "Bur-0", "Col-0", "Ct-1", "Edi-0", "Ge-0", "Kn-0", "Mh-1", | |
"Mr-0", "Mt-0", "N13", "Oy-0", "Sakata", "Shahdara", "St-0", "Stw-0", "Tsu-0"), | |
stringsAsFactors = FALSE | |
) | |
gg1 + | |
geom_point(data = labs, aes(x = long, y = lat), color = "red", size = 3) + | |
#geom_label_repel(data = labs, aes(x = long, y = lat, label=names), box.padding = 1) + | |
geom_text_repel(data = labs, aes(x = long, y = lat, label=names), box.padding = 1, size = 4.5) + | |
xlab("longitude") + ylab("Latitude") + | |
ggtitle("18 Arabidopsis ecotypes used in this study") | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment