Description Usage Arguments Value Examples
Plots a filled grid map of US states, represented as hexagons
1 2 3 | plotGridMap(x, state_var = "state.abb", fill_var, alpha_var = NULL,
label_var = state_var, label_color_var = NULL,
label_color = "black", outline_color = "black")
|
x |
data.frame with data to plot |
state_var |
name of of column in |
fill_var |
column from |
alpha_var |
column from |
label_var |
name of column in |
label_color_var |
if NULL, then labels have a fixed color (specified by |
label_color |
color for label text. Has no effect if you pass a value to |
outline_color |
color for state hex outlines |
Returns a ggplot
1 2 3 4 5 6 7 8 9 10 11 | # a data.frame of states with random categorical value
my_dat <- data.frame(state.abb, value=sample(LETTERS[1:5], 50, replace=T))
# build grid map plot
my_dat <- data.frame(state.abb = c(state.abb, 'DC'),
value=sample(LETTERS[1:5], 51, replace=T))
# note you can manipulate the resultant object as you would any ggplot object
my_grid_map +
scale_fill_brewer(type='qual') +
labs(title = 'States by Category', fill = 'Category')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.