Search code examples
rmapsmap-projections

How to add axis to map in cylindrical equal area projection? Why are the polygon lines at the border stretched out?


Goal

  1. Add axis that labels coordinates at 30deg latitude, 60deg longitude.
  2. Fix the polygon lines, around ~west Asia, eastern Europe.

Question 1

  1. I do not know what the scale of the axis is when I specify cylindrical equal area projection. (-180 to 180 is ~ -3.1 to 3.1 and -90 to 90 is ~ 1 to 1?)

Question 2

  1. How can I fix the world map polygon that is distorted around west Asia or eastern Europe? wrap = TRUE fixed most of the polygon issues but that one remains.

Sample

library(mapproj)
library(maps)
# World Map, cylindrical equal area projection
map(database= 'world', 
xlim=c(-180,180), 
ylim=c(-90,90),
projection='cylequalarea',
parameters = 0,
fill=T,
col="#f2f2f2",
bg="white",
lty=1,
lwd=1,
orientation=c(90,0,225),
resolution=0,
wrap=T,
)
# Default axis
map.axes()
# Desired axis
axis(1,
at=c(-120,-60,0,60,120),
labels = c('-120','-60','0','60','-120'),
pos=-90)

Map

enter image description here


Solution

  • Here is what works for me:

    CylEqAreaMAP <- function(){
      library(mapproj)
      library(maps)
      # World Map, cylindrical equal area projection
      map(database = "world2", 
          regions = ".", 
          exact = FALSE, 
          boundary = FALSE,
          interior = FALSE,
          lty = 0,
          projection='cylequalarea', parameters = 0,
          fill = TRUE, 
          col = '#f2f2f2', 
          plot = TRUE, 
          add = FALSE, 
          namesonly = FALSE,
          xlim = c(0,360), ylim = c(-90,90), 
          wrap = TRUE, 
          resolution = 1,
          type = "l", bg = par("bg"), 
          myborder = 0.01, namefield="name")
      # Desired axis
      ## long
      axis(1,
           at=c(-2.05,-1,0,1,2.05),
           labels = c(parse(text = '60^o*E'),parse(text = '120^o*E'),parse(text = '180^o'),parse(text = '120^o*W'),parse(text =  '60^o*W')),
           lwd.ticks = 1,
           lwd = 0,
           pos = -1.1,
           tck =0.01,
           cex.axis = 0.75
      )
      ## lat
      axis(2,
           at=c(-0.67,-0.33,0,0.33,0.67),
           labels = c(parse(text = '60^o*S'),parse(text = '30^o*S'),parse(text = '0^o'),parse(text = '30^o*N'),parse(text = '60^o*N')),
           las =1,
           lwd =0,
           lwd.ticks = 1,
           tck =0.01,
           cex.axis = 0.75
      )
      # title
      title("Site Locations")
    }
    

    The above code creates this map, projection = '' when adding points to plot using mapproject() would have saved me submitting an embarrassing plot. Hopefully this spares someone else some time.

    World2 map, cylindrical equal area projection