Description Usage Arguments Value Author(s) See Also Examples
Given no arguments it will print country names stored in the 'NAME' column of getMap
onto an existing map at the
centroids of each country polygon, stored in the 'LAT' and 'LON' columns.
Alternatively the user can specifiy
a data frame or SpatialPolygonsDataFrame in which case they need to define the column containing the country names
(nameCountryColumn) and optionally a 2nd attribute column to print (nameColumnToPlot).
First you need to create a map plot, for example using mapCountryData
or mapBubbles
.
1 2 3 4 5 6 7 8 | labelCountries(dF = ""
, nameCountryColumn = "NAME"
, nameX = "LON"
, nameY = "LAT"
, nameColumnToPlot = ""
, col = 'grey'
, cex = 0.8
, ...)
|
dF |
dataframe or SpatialPolygonsDataFrame |
nameCountryColumn |
name of column containing country names to be printed on the map (could also be set to any other column in the dataframe) |
nameX |
name of column containing the X variable (longitude), not needed if dF is a SpatialPolygonsDataFrame |
nameY |
name of column containing the Y variable (lattitude), not needed if dF is a SpatialPolygonsDataFrame |
nameColumnToPlot |
name of an attribute column in the data frame the value of which will be appended to the country names |
col |
colour for labels, default 'grey', can be e.g. rgb(1,1,0,alpha=0.5) |
cex |
sizing of labels, default = 0.8 |
... |
other parameters that can be passed to text(), e.g. pos=4 to right, (1=below, 2=left, 3=above) |
nothing
andy south
1 2 3 4 | mapCountryData()
labelCountries()
labelCountries(nameColumnToPlot = "POP_EST")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.