4
아메리카 대륙에서 네덜란드로의 수출에 관한지도를 만들고 있습니다. 내 데이터를 시각화하기 위해 미주에서 네덜란드까지의 화살표가있는지도를 만들고 싶습니다. 나는 cshapes 세계지도와 ggplot2를 사용한다.ggplot2의 두 위치 사이에 곡선을 그립니다.
data = data.frame("Country.name" = c("Brazil","USA","Canada","Paraguay","Uruguay"), "lng" =
c(14.23,37,56.13,-23.44,-32.52), "lat" = c(-51.92,-95.71,-106.34,-58.44,-55.77))
require(cshapes)
cshp.data = cshp(date=as.Date("2012-1-1"), useGW=TRUE)
region.data.frame = fortify(cshp.data, region = "ISO1AL3")
ggplot(region.data.frame) + geom_polygon(aes(long,lat,group=group)) +
geom_segment(data = data, aes(x = lat, y = lng, xend= (5.29 - 0.1 * (5.29 - lat)), yend= (52.13 - 0.1 * (52.13 - lng))),
arrow=arrow(length=unit(0.5,"cm"), angle = 45, type = "closed"))
직선을 그릴 때 선이 겹치는 것을 발견했습니다. 이것은 추한 것입니다. 따라서 ggplot2 내의 좌표 사이에 곡선을 그릴 방법을 찾고 있으므로 중복되지 않습니다. 내가 여기에 몇 가지 이유 cshapes
실행되지만 없습니다
아마도 대원 경로 뭔가 될 수 있을까? [geosphere 패키지] (http://cran.r-project.org/web/packages/geosphere/vignettes/geosphere.pdf)를 살펴보십시오. – Henrik
사용 중일 수 있습니다. http://stackoverflow.com/questions/18753863/bend-line-toward-center-of-triangle-ggplot2 –