makeMap: Creates a Map

Description Usage Arguments Examples

View source: R/makemap.R

Description

This function takes in a dataframe, shapefile path, and variable and outputs a .png file

Usage

1
2
3
4
5
makeMap(data, map, palette = "Greens", title = "", fill_label = "",
  output = "out.png", width = 7, height = 7, per = FALSE,
  reverse_colors = FALSE, reverse_legend = TRUE,
  projection = c("mercator", "albers"), proj_args = NULL, border = NULL,
  border_color = "black", size = 0.25)

Arguments

data

Dataframe with the data you want to plot. Must have two columns with the first column called "id" matching up with the "id" column in the map dataframe.

map

Dataframe with shapefile data (after using fortify()).

palette

Color Brewer palette to use (http://colorbrewer2.org/).

title

String with title of the map, defaults to blank.

fill_label

String with a label for a legend, defaults to blank.

output

String with output filename, defaults to "out.png".

width

Defaults to 7.

height

Defaults to 7.

per

TRUE if labels are a percentage (0.2 -> 20%), defaults to FALSE.

reverse_colors

TRUE if you want to reverse the colors on the legend, defaults to FALSE.

reverse_legend

TRUE if you want to reverse the legend, defaults to TRUE.

projection

Method of projection, takes in Mercator or Albers.

proj_args

Any arguments necessary for the projection method (Albers requires lat0 and lat1 arguments).

border

Optional parameter if you want different borders (i.e. census tract data with county borders).

border_color

Color of the borders, defaults to black.

size

Size of the borders, defaults to 0.25.

Examples

1
makemap(data=d, map = map)

kevjohnson/mymaps documentation built on May 20, 2019, 9:20 a.m.