Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/wcf/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
R ggplot将弯曲的线段放置在使用ggmap创建的贴图上_R_Ggplot2_Ggmap - Fatal编程技术网

R ggplot将弯曲的线段放置在使用ggmap创建的贴图上

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

我正在使用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(-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)
图书馆(网格)
数据超过该距离的“直线”是大圆路线,在该投影或大多数其他投影中不会显示为直线。超过该距离的“直线”是大圆路线,在该投影或大多数其他投影中不会显示为直线