map.cities | R Documentation |
Adds city locations and (optionally) names to an existing map using a specified database.
map.cities(x = world.cities, country = "", label = NULL, minpop = 0,
maxpop = Inf, capitals = 0, cex = par("cex"), projection = FALSE,
parameters = NULL, orientation = NULL, pch = 1, ...)
x |
Name of database. See |
country |
If the string country is specified, limit the displayed cities to be from within the specified country, province or state (depending on how the database has been constructed). |
label |
If |
minpop |
The minimum value of population below which a particular city will not be shown. |
maxpop |
The maximum value of population above which a particular city will not be shown. |
capitals |
Selection of capitals-only display. Capitals may be 1 (country capital),
2 (provincial, state, or regional capital) or 3 (local capital). See
|
cex |
The value of cex acts to override the current value of character size expansion. |
projection |
Boolean or character value. If |
parameters |
numeric vector of parameters for use with the |
orientation |
a vector |
pch |
plotting character to use for marking city location. See
|
... |
Further plotting parameters may be specified as for the commands
|
The database is searched for all cities matching the specified criteria and fitting within the limits of the plot currently displayed. The default database is of all cities that have a population greater than a certain threshold or which are capital cities of a country or island territory. The threshold varies from country to country, but in general is no higher than about 40,000. The data were originally obtained from Stefan Helders' website (http://www.world-gazetteer.com), which now redirects to http://www.populationmondiale.com. There are no recent updates available.
There are three supplied databases, world.cities (the default), us.cities
and canada.cities. The latter two, which need to be made available by
using a 'data()'
call, include the state or province name with the
city name (thanks to John Woodruff jpwoodruff@irisinternet.net
for the state and province information).
Note that if the underlying map is "Pacific-centric", i.e. longitudes exceed 180 degrees, and a projection is used, then the map.cities data must be transformed appropriately.
No value is returned from map.cities.
All cities within the boundaries of the plot containing the current map are added to the plot. Note that it is possible that the boundaries of the plot exceed the boundaries of the map requested, and so more cities than were expected might be shown.
world.cities
, canada.cities
,
us.cities
map("world", "China")
map.cities(country = "China", capitals = 2)
map("state", "New Jersey")
data(us.cities)
map.cities(us.cities, country="NJ")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.