make_map_grid: Produce a grid of maps based on two categorical variables

View source: R/make_map_grid.R

make_map_gridR Documentation

Produce a grid of maps based on two categorical variables

Description

This function takes in data and produces a map grid based on two categorical variables.

Usage

make_map_grid(
  data,
  var,
  xvar,
  yvar,
  shp_tracts,
  palette = "sequential",
  jenksbreaks = T,
  neg_bins = 3,
  pos_bins = 3,
  breaks = scales::extended_breaks(n = 6),
  labels = scales::comma,
  limits = NULL,
  save = F,
  savename = "plot.png",
  caption = paste0(frb_caption, ses_caption, period_caption),
  width = 6.33,
  height = 4.97
)

Arguments

data

Data with a column containing tractid10, two categorical variables, and variable of interest.

var

Name of column containing variable to plot.

xvar

Name of column containing categorical variable to plot along x-axis.

yvar

Name of column containing categorical variable to plot along y-axis.

shp_tracts

"US_tract_2010.shp" loaded object

palette

Color palette: "sequential" (default) or "diverging"

jenksbreaks

Uses Jenks Breaks when T, otherwise uses continuous color scale

neg_bins

For Jenks breaks, number of negative color bins. Default is 3.

pos_bins

For Jenks breaks, number of positive color bins. Default is 3.

breaks

Gradient scale breaks, either numeric vector or scales::extended_breaks(n = 6)

labels

Gradient scale labels, either character vector or scales::percent or scales::comma

limits

Gradient scale limits, c(min, max)

save

T if user would like to return plot object and save file, F (default) to just return object.

savename

File name of map for saving.

caption

Figure caption

width

Width of figure

height

Height of figure

Value

A grid of maps based on two categorical variables


Changing-Cities-Research-Lab/bayViz documentation built on Dec. 5, 2023, 12:06 p.m.