r - How to add axis to map in cylindrical equal area projection? Why are the polygon lines at the border stretched out? -
goal
- add axis labels coordinates @ 30deg latitude, 60deg longitude.
- fix polygon lines, around ~west asia, eastern europe.
question 1
- i not know scale of axis when specify cylindrical equal area projection. (-180 180 ~ -3.1 3.1 , -90 90 ~ 1 1?)
question 2
- how can fix world map polygon distorted around west asia or eastern europe?
wrap = true
fixed of polygon issues 1 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
here works 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 map, projection = ''
when adding points plot using mapproject()
have saved me submitting embarrassing plot. spares else time.
Comments
Post a Comment