build_bmap: Build a bivariate colour map

View source: R/build_bmap.R

build_bmapR Documentation

Build a bivariate colour map

Description

This function builds a map that visualises estimates and errors simultaneously with a bivariate colour scheme.

Usage

build_bmap(
  data,
  geoData = NULL,
  id = NULL,
  border = NULL,
  palette = "BlueYellow",
  size = NULL,
  terciles = FALSE,
  bound = NULL,
  flipAxis = FALSE
)

Arguments

data

A data frame.

geoData

A spatial polygons data frame.

id

Name of the common column shared by the objects passed to data and geoData. The estimates and errors in the data frame will be matched to the geographical regions of the spatial polygons data frame through this column.

border

Name of geographical borders to be added to the map. It must be one of county, france, italy, nz, state, usa or world (see documentation for map_data for more information). The borders will be refined to match latitute and longtidue coordinates provided in the data frame or spatial polygons data frame.

palette

Name of colour palette or character vector of hex colour codes from the build_palette function. Colour palette names include BlueYellow, CyanMagenta, BlueRed and GreenBlue.

size

An integer between 1 and 20. Value controls the size of points when geoData = NULL. If size = NULL, the points will remain the default size.

terciles

A logical value. This provides the option to define numerical bounds for the colour key grid using terciles instead of equal intervals.

bound

Output from the findNbounds function if a different set of data is required to bound the map. This is useful if you are wanting to create a bivariate map across multiple years and show colours that correspond to the same key. Default is NULL.

flipAxis

A logical value. Whether to place the axis on the opposite sides or not.

Details

If geoData remains NULL, the function will produce a map of plotted points representing specific sites; in this case, the data frame must include latitude and longitude coordinates in columns "long" and "lat".

See Also

build_bkey

Examples

data(us_data)
data(us_geo)
poverty <- read.uv(data = us_data, estimate = "pov_rate", error = "pov_moe")

# bivariate map with a spatial polygons data frame
map <- build_bmap(data = poverty, geoData = us_geo, id = "GEO_ID",
 border = "state", terciles = TRUE)
view(map)


pkuhnert/VizU documentation built on March 19, 2024, 10:51 p.m.