Skip to contents

Generates a homefield map and saves as a .png file at a specified location.

Usage

homefield_map(x, threshold = 10000, output_file, title = NULL, credit = NULL)

Arguments

x

Data frame created by other homefield functions or including the following columns:

entity - identifies each entity (ex. school name - Iowa State, Minnesota, Bowling Green).

lat - latitude of entity

lng - longitude of entity

color - hexadecimal color to fill entity territories (ex. #cfab7a).

image - image url or local file path to be placed on at least one territory and all territories larger than the threshold.

Columns must also be of equal length and match the specified names exactly.

threshold

(Numeric required): If territory above threshold (area in km^2), a secondary logo will be generated for that territory. Defaults to 10,000 km^2.

output_file

(String required): Local file path ending in .png.

title

(String required): Title of the map.

credit

(String required): Name of the map author.

Examples

if (FALSE) cfb_data <- cfb_undefeated(season = 2016, week = 6)
if (FALSE) homefield_map(x = cfb_data, output_file = paste0(getwd(),"/homefield_map_example.png"))