Description Usage Arguments Value See Also Examples
Plot a choropleth map for an indicator
1 2 3 4 5 6 7 8 9 10 11 12 13 |
data |
data.frame object to plot using ggplot2 functions |
ons_api |
string; GeoJSON address provided from the ONS geography portal |
area_code |
field containing area codes to join to shape file imported from ONS API |
fill |
field to be used to determine the colouring of the areas (unquoted) |
type |
string; the output map required. Can be "static" or "interactive" |
value |
field containing variable to be plotted on x axis (unquoted) |
name_for_label |
if interactive map, name of field containing area names to be used for label (unquoted) - optional |
title |
string; title of chart |
subtitle |
string; text to use as subtitle to graph |
copyright_size |
number; fix the size of the copyright text |
copyright_year |
number (length 4 characters) or Date class; the copyright year displayed at bottom of the map. Applies to static maps only |
a either a static or interactive ggplot choropleth map
Other quick charts:
box_plots()
,
compare_areas()
,
compare_indicators()
,
overview()
,
population()
,
trends()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | ## Not run:
ons_api <- "https://opendata.arcgis.com/datasets/687f346f5023410ba86615655ff33ca9_4.geojson"
p <- map(mapdata,
ons_api = ons_api,
area_code = AreaCode,
fill = Significance,
title = "Map example",
subtitle = "An indicator for Upper Tier Local Authorities England",
copyright_year = 2019)
p
## For an interactive (leaflet) map
p <- map(mapdata,
ons_api = ons_api,
area_code = AreaCode,
fill = Significance,
type = "interactive",
value = Value,
name_for_label = AreaName,
title = "An indicator for Upper Tier<br>Local Authorities England")
p
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.