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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
| setwd("/Users/jinlong/world map")
library(maps)
library(mapdata)
library(openxlsx)
library(ggplot2)
library(ggsn)
library(legendMap)
\
library(maptools)
\
china0 <-readShapePoly("bou1_4p")
china_df <-fortify(china0)
\
cities <-read.csv("simplemaps-worldcities-basic.csv")
cities <-cities[sample(1:nrow(cities),size =200), ]
pdf(file ="sampling sites location.pdf",width =11.5,height =5.8)
\
\
\
rrr <-ggplot()+
borders(colour='darkgrey')+
geom_polygon(data =china_df,
aes(x =long, y =lat, group =group), colour ="darkgrey",
fill ="white")+
geom_point(data =cities,
aes(x=lng,y=lat,colour=pop),size =2)+
theme_bw()+
ggtitle("Population of World Cities")+
scale_bar(lon =100,lat =-60,
distance_lon =1000,distance_lat =200,
distance_legend =500,dist_unit ="km",
arrow_length =0,arrow_distance =0,
arrow_north_size =0)+
xlab("Longitude (Degree)")+
ylab("Latitude (Degree)")+
scale_colour_gradientn(colours=c("green","yellow","orange","red"))
north2(rrr,.82,.88)
dev.off()
|