最近用R画了一张地图,在地图上用经纬度标出了想要的点,具体的数据参见文末
library(pacman)
p_exists('leaflet', local = T)
p_exists('maptools', local = T)
p_exists('maps', local = T)
library(ggplot2)
library(leaflet)
library(ggmap)
library(sp)
library(maptools)
library(maps)
library(tidyverse)
library(readxl)
a1 <- read_xlsx("mapdata.xlsx")
visit.x <- a1$Longitude
visit.y <- a1$Latitude
a1$cnumber <- as.factor(a1$cnumber)
zdcolor <- a1$cnumber
mapworld <- borders("world", colour = "#CACACA", fill = "#CACACA")
ggplot() +
theme(panel.background = element_blank()) +
mapworld +
ylim(-60,90) +
theme(axis.ticks.y = element_blank(), axis.text.y = element_blank()) +
theme(axis.ticks.x = element_blank(), axis.text.x = element_blank()) +
labs(x = NULL) +
labs(y = NULL) +
theme(panel.grid.major = element_blank(),panel.grid.minor = element_blank()) +
aes(x = visit.x, y = visit.y, color = zdcolor) +
geom_point(size = 5) +
scale_color_manual(values = c("#27609F","#F9D172","#C31C26"), limits = c('1', '2', '3')) +
theme(axis.ticks.y = element_blank(), axis.text.y = element_blank()) +
theme(axis.ticks.x = element_blank(), axis.text.x = element_blank()) +
labs(x = NULL) +
labs(y = NULL) +
theme(legend.position = "none")