I've been struggling with the following R plotting of the US map and wonder if any of you have suggestions on how the plot should be done.
Here is what I have tried:
US <- map("state",fill=TRUE, plot=FALSE) US.names <- US$names US.IDs <- sapply(strsplit(US.names,":"),function(x) x) US_poly_sp <- map2SpatialPolygons(US,IDs=US.IDs,proj4string=CRS("+proj=longlat + datum=wgs84")) plot(US_poly_sp,col="white",axes=TRUE)
With the above code, I can add points if I need to. For example, suppose I have a location with lat=35 and lon=-110, then I can simply use the next line since the latitude and longitude of the spatial polygon I created from the object US contains information on the location:
How can I get a plot of the map that is curved, as generated from the following line and also add points which are given in terms of their latitude and longitude?
US <- map("state",proj="albers", par=c(30,40), plot=TRUE)
I know it has something to do with the projection of maps, but the moment I projected the map, the corresponding range of the latitude and longitude (US$range) changes.