I think what you are missing is that the default map database is "world".
If you use:
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(regions="USA", 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")
I think you will get what you want (but what you want is not exactly clear).
[I am not sure why this happens, but it seems to be an artifact of the
projection code.]
[All your examples have been very confusing, since you talk about plotting the "states",
but in fact your example code plots only a grid.]
HTH
Ray Brownrigg
Dr. Alireza Zolfaghari wrote:
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]]
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.