> From: YIHSU CHEN <[EMAIL PROTECTED]>
> Date: Thu, 27 Apr 2006 10:50:49 -0400
>
> I'm trying to use packages "maps" and "mapdata" (see blow) to display
> the research resutls on map (Mid-Atlantic region). In particular, I
> need to mark a number of points in the map by giving their latitude and
> longitude information. For instance, I would like to mark a point on
> (long, lat) =(75.56027, 39.09271). Also, I need to mark several cities
> that I suspect might not in the "world.cities" database such as
> Baltimore, etc. Presumably, I can do the same thing by finding out the
> lat and long infor of Baltimroe and add text next to the point I mark.
>
> Thanks a billion
>
> Yihsu
>
>
> library(maps)
> library(mapdata)
> state.list <- c("maryland","new jersey","west virginia",
> "virginia","ohio","delaware","pennsylvania","kentucky","indiana","north
> carlina")
> map("state",state.list)
> map.cities(x=world.cities, Country="US",minpop=100000)
>
Several things:
1) the US is west of longitude 0, so you need longitude -75.56027
2) map.cities uses x=world.cities by default, so you don't need to
specify it in your call, but if you do specify it, you need to precede
it with a call to:
data(world.cities)
[I guess this is a bug, perhaps just at the documentation level]
3) map.cities takes country= as an argument, not Country=
4) The US is identified in the maps package as USA, so you would use
country="USA" (but you don't need country= anyway, beacause your map is
only of the USA, so there are no cities to exclude).
5) Baltimore is in world.cities, try map.cities(minpop=500000, label=T)
6) If you really want North Carolina, you need to spell it correctly
So what you need is:
library(maps)
# library(mapdata) # not needed for this
state.list <- c("maryland", "new jersey", "west virginia", "virginia",
"ohio", "delaware", "pennsylvania", "kentucky", "indiana", "north carolina")
map("state", state.list)
map.cities(minpop=100000)
Hope this helps,
Ray Brownrigg
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html