Skip to content

Instantly share code, notes, and snippets.

@valentinitnelav
Created December 23, 2016 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save valentinitnelav/8992f09b4c7e206d39d00e813d2bddb1 to your computer and use it in GitHub Desktop.
Save valentinitnelav/8992f09b4c7e206d39d00e813d2bddb1 to your computer and use it in GitHub Desktop.
# __________ Create data.frame for graticule labels
# use together with graticule of 10 dg step for latitude and 20 dg step for longitude
lbl.Y <- data.frame(lon = rep(c(-175,175), each=17), # 175 dg used to fit latitude labels inside Earth; adjust this value to shift positions of labels
lat = rep(seq(from=80, to=-80, by=-10), times=2))
lbl.Y$dir <- ifelse(lbl.Y$lat == 0, "", ifelse(lbl.Y$lat > 0, "°N", "°S"))
lbl.Y$lbl <- paste0(abs(lbl.Y$lat), lbl.Y$dir)
lbl.X <- data.frame(lon = rep(seq(from=160, to=-160, by=-20), times=2),
lat = rep(c(-85,85), each=17)) # 85 dg used to fit latitude labels inside Earth; adjust this value to shift positions of labels
lbl.X$dir <- ifelse(lbl.X$lon == 0, "", ifelse(lbl.X$lon > 0, "°E", "°W"))
lbl.X$lbl <- paste0(abs(lbl.X$lon), lbl.X$dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment