packrat/lib/x86_64-pc-linux-gnu/3.2.3/sp/demo/polar.R

# polar projection with map:
library(maps)
m = map(xlim = c(-180,180), ylim = c(-90,-70), plot = FALSE, fill = TRUE)
IDs <- sapply(strsplit(m$names, ":"), function(x) x[1])
library(maptools)
m <- map2SpatialPolygons(m, IDs=IDs, proj4string = CRS("+init=epsg:4326"))
gl = gridlines(m, easts = seq(-180,180,20))
polar = CRS("+init=epsg:3031")
plot(spTransform(gl, polar))
plot(spTransform(m, polar), add = TRUE, col = grey(0.8, 0.8))
l = labels(gl, polar, side = 3)
# pos is too simple here, use adj:
l$pos = NULL 
text(l, adj = c(0.5, -0.3), cex = .85)
l = labels(gl, polar, side = 2)
l$srt = 0 # otherwise they are upside-down
text(l, cex = .85)
title("grid line labels on polar projection, epsg 3031")
etsakl/DasyMapR documentation built on May 16, 2019, 9:07 a.m.