[R] Map using projection

Dr. Alireza Zolfaghari
Thu, 12 Mar 2009 23:01:02 -0000

Hi list,
I have a real problem with plotting US state map. When I try to plot the
northern state, there will be some blank space in the top of graph (see case
1 example), and when I plot southern states, there will be a blank space in
the bottom of plot (see case 2). I spent almost 2 days to figure out a
solution, but could not. Would you help me if you know what the problem is?
Regards,
Alireza

#################################################
#case 1
    library(maps)
    require("mapproj")
    longlatLimit<-c(-107,-93,40,52)
    par(plt=c(0,1,0,1),cex=1,cex.main=1)  #Set plotting parameters
    #map(projection="azequalarea",
type="n",xlim=longlatLimit[1:2],ylim=longlatLimit[3:4])
    map(projection="azequalarea",
type="n",xlim=longlatLimit[1:2],ylim=longlatLimit[3:4])
    bound<-c(floor(longlatLimit[1]), ceiling(longlatLimit[2]),
floor(longlatLimit[3]), ceiling(longlatLimit[4]))
    map.grid(lim=bound,col="light grey")
#################################################
#case 2
    library(maps)
    require("mapproj")
    longlatLimit<-c(-107,-93,25,37)
    par(plt=c(0,1,0,1),cex=1,cex.main=1)  #Set plotting parameters
    #map(projection="azequalarea",
type="n",xlim=longlatLimit[1:2],ylim=longlatLimit[3:4])
    map(projection="azequalarea",
type="n",xlim=longlatLimit[1:2],ylim=longlatLimit[3:4])
    bound<-c(floor(longlatLimit[1]), ceiling(longlatLimit[2]),
floor(longlatLimit[3]), ceiling(longlatLimit[4]))
    map.grid(lim=bound,col="light grey")

	[[alternative HTML version deleted]]