Plot a choropleth map for an indicator
map(
data,
ons_api,
area_code,
fill,
type = "static",
value,
name_for_label,
title = "",
subtitle = "",
copyright_size = 4,
copyright_year = Sys.Date()
)
data.frame or tibble which will be fed into ggplot functions. This object should contain the fields used for the arguments within this function
string; GeoJSON url of a shape file. This can be found on the ONS geography portal
field containing area codes to join to shape file imported from ONS API
unquoted field name for the field to be used to determine the colouring of the bars; usually reflecting significance. The values that values that can be used in this field with predetermined colours are: 'Better', 'Higher', 'Similar', 'Lower', 'Worse', 'Not compared', 'None'
string; the output map required. Can be "static" or "interactive"
if interactive map, unquoted field name for the field containing values to be used for label of polygons when hovering
if interactive map, unquoted field name for the field containing area names to be used for label of polygons - optional
string; title of chart
string; subtitle of the chart
number; used to control the size of the copyright text
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()
if (FALSE) {
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}