R ggplot将弯曲的线段放置在使用ggmap创建的贴图上
我正在使用ggmap在地图上绘制geom_段,代码如下:R ggplot将弯曲的线段放置在使用ggmap创建的贴图上,r,ggplot2,ggmap,R,Ggplot2,Ggmap,我正在使用ggmap在地图上绘制geom_段,代码如下: rm(list=ls()) library(ggmap) library(ggplot2) library(grid) data <- data.frame(point=c("One"), latitude=c(-20),longitude=c(-25), latitude_end=c(50),longitude_end=c(50),sample=c("One")) map <- get_map(location=c(-2
rm(list=ls())
library(ggmap)
library(ggplot2)
library(grid)
data <- data.frame(point=c("One"), latitude=c(-20),longitude=c(-25), latitude_end=c(50),longitude_end=c(50),sample=c("One"))
map <- get_map(location=c(-20,-10,55,30), zoom = 3, maptype = "terrain", scale = 2)
p0 <- ggmap(map, size=c(100, 200), extent="device", legend="bottom")
p1 <- p0 +
geom_segment(data=data, aes(x=longitude, y=latitude, xend=longitude_end, yend=latitude_end),
colour="black") +
geom_point(data = data, aes(x =longitude, y = latitude), size=3,shape = 16)
png("plot.png")
p1
dev.off()
rm(list=ls())
图书馆(ggmap)
图书馆(GG2)
图书馆(网格)
数据超过该距离的“直线”是大圆路线,在该投影或大多数其他投影中不会显示为直线。超过该距离的“直线”是大圆路线,在该投影或大多数其他投影中不会显示为直线