View source: R/visualizations.R
ff_plot_demo_bar | R Documentation |
This function creates a bar chart of a given demographic for the most recent year within Forsyth County.
ff_plot_demo_bar( data, demographic, y_axis_title, percent = F, dollar = F, color_palette = "Set 2" )
data |
Name of the dataframe with columns outlined above |
demographic |
String in the 'type' column that signifies the demographic |
y_axis_title |
Title for y axis and tooltip |
percent |
Boolean (TRUE / FALSE), whether estimate value is a percent; this will add percent labels to axis |
dollar |
Boolean (TRUE / FALSE), whether estimate value is a dollar; this will add dollar labels to the axis |
color_palette |
string representing the color palette to use, possible palettes are qualitative palettes from the <a href="http://library http://colorspace.r-forge.r-project.org/reference/hcl_palettes.html">'colorspace' library</a>. |
The input dataset needs to have, at a minimum, columns of the following form and with the following names: - year: year of the data - geo_description: geography (needs Forsyth County as one of the geographies) - type: general description of the demographic identifier (Race and Ethnicity, Total Population, etc) - subtype: specific description of the demographic identifier (African American, Employment Rate, etc) - estimate: value
bar plot of the most recent year of data
years <- seq(2006, 2017, 1) df <- data.frame( year = rep(seq(2007, 2017, 1), each=3), geo_description = "Forsyth County, NC", type = "Race and Ethnicity", subtype = rep(c("African American", "White", "Hispanic / Latino"),11), stringsAsFactors = FALSE ) ff_plot_demo_bar(data = df, demographic = "Race and Ethnicity", y_axis_title = "Employment Rate (%)", percent = T, dollar = F)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.