Description Usage Arguments Value Examples
Create a heat map of Chicago with continuous shading.
1 2 3 4 |
regions |
The type of region to plot. Options include: "CAs", "tracts," "districts," and "zips." |
summary_df |
A data frame with summary statistics by region. Should have one row for each region. |
regions_var |
The variable in summary_df that identifies the region. For example, if type = "CAs" a common summary_var would be "Community.Areas." In general, regions_var should be numeric (e.g. use community area numbers, not names.). |
fill_var |
The variable that determines color. For example, if the map shows homicides by police district, the fill_var would be the field that contains homicide totals. |
legend_name |
Self Explanatory. Should be a character vector of length one. |
palette |
The color palette. Current options are: green, blue, red, organge, and purple. |
low_color |
If palette is set to NULL, the low end of the color range you want to use. |
high_color |
The high end of your color range |
na_replace |
What value should replace NAs in the fill_var. This arises most commonly in maps of homicides, where regions with zero homicides are sometimes missing from df.y. |
lines |
Color of border lines. Default is black. |
title |
Title. |
title_size |
Title size. |
region_labels |
Option to add labels for CAs or districts. Default is false |
A map of Chicago. More specifically, an object of type "ggplot."
1 2 3 4 5 6 7 8 | data(hom_14)
# Create summary table
hom_sum <- dplyr::summarise(group_by(hom_14, District), homicides = n())
h_map <- heat_map_continuous(type = "districts", summary_df = hom_sum, regions_var = "District",
fill_var = "homicides", legend_name = "Homicides",
na_replace = 0)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.