[R] Interplay rnaturalearth, vwline

Ferri Leberl ferri@leberl @ending from gmx@@t
Tue Nov 13 18:02:29 CET 2018


Dear All,
There is something I don't understand fundamentally about handling geocoords with vwlines, as the axample below may illustrate.
vwlines seems to require values somewhere between 0 and 1 as shares of the plot length and width, but obviously that's not the complete story: Point (1,1) is slightly outside.
Which spacial framework does vwlines employ? 
How do I have to transform geoocoords to fit them into vwline?
Thank you in advance!
Yours, Ferri




library(rnaturalearth)
library(grid)
library(vwline)
# Install vwline via:
#library(devtools); install_github("pmur002/vwline/pkg using v0.1")
#mittex<--59.75#central meridian
#mittey<--62.316667#central latitude
mittex<--60.5617;mittey<--62.9832#Whalers Bay
#mittex<-120;mittey<-0#Sulawesi
band<-2#halve edge length of the depicted square, in degrees
map<-ne_countries(scale=10)#the source map
if(require(sp)){plot(map,ylim=c(mittey-band,mittey+band),xlim=c(mittex-band,mittex+band))}#plot the map
X<-c(-1,-1,-1,0,0,0,1,1,1)
Y<-c(-1,0,1,-1,0,1,-1,0,1)
points(mittex+X*band,mittey+Y*band,col="red")#The map does NOT end at xlim and ylim
grid.vwline(c(0,1),c(0,1),c(1/1000,1/1000))
grid.vwline(c(0,1),c(1,0),c(1/1000,1/1000))
#The vwlines miss the central dot; (1,1) is outside the plot



More information about the R-help mailing list