Reputation:
map("usa") by default displays a map without Alaska and Hawaii. map("world") has Antartica by default. Is there any way to say "include alaska", "exclude antartica" etc?
Upvotes: 7
Views: 10779
Reputation: 6410
If you looking just for those areas, the brutal solution would be to use world map, specify USA as a region
and define latitude/longitude to create limits, so the map will only display specific area:
library(maps)
long <- c(-180,-50)
lat <- c(10,80)
map("world",regions=".*usa",xlim=long,ylim=lat)
Upvotes: 4
Reputation: 263481
Quick answer:
nams <- map("world", namesonly=TRUE, plot=FALSE)
map("world", region=nams[-grep("Antarctica", nams)])
Longer answer:
The maps data in "world" is referenced by region names and these are generally character data in "continent:country" or "continent:subregion" format. To get those names which are in an external database, you need to first use maps("world" , ...) with parameters that return only the names and not all of hte other coordinates. If you want to find all the "Antarctica" containing entries you need to use grep() to identify their position in the returned names vector.
Upvotes: 5