diff --git a/3_visualize.R b/3_visualize.R index c294ee7db78f19dc45db5359fe9e016f984c8f6e..72b5fba2362f17a4049889a32e3aabb74eeda076 100644 --- a/3_visualize.R +++ b/3_visualize.R @@ -27,6 +27,8 @@ p3_targets <- list( plot_census_map( census_data = p2_perc_census_acs5_layers_sf[[4]], percent_leg = TRUE, + lim_vals = c(0, 100), + break_vals = c(0, 25, 50, 75, 100), var = 'percent', conus_sf = p1_conus_sf, outfile_path = "3_visualize/out/perc_hispanic_census_2022.png", @@ -46,6 +48,8 @@ p3_targets <- list( plot_census_map( census_data = p2_census_acs5profile_household_sf, percent_leg = TRUE, + lim_vals = c(0, 100), + break_vals = c(0, 25, 50, 75, 100), var = 'estimate', conus_sf = p1_conus_sf, outfile_path = "3_visualize/out/perc_occupied_households_2022.png", @@ -84,9 +88,11 @@ p3_targets <- list( plot_census_map( census_data = p2_census_acs5sub_disability_data[[1]], percent_leg = TRUE, + lim_vals = c(0, 50), + break_vals = c(0, 10, 20, 30, 40, 50), var = 'estimate', conus_sf = p1_conus_sf, - outfile_path = "3_visualize/out/perc_disable_census_2022.png", + outfile_path = "3_visualize/out/perc_disabled_census_2022.png", leg_title = "Percent disabled, 2022", viz_config_df = p0_viz_config_df, viz_config_pal = p0_viz_config_pal$demographic_characteristics, diff --git a/3_visualize/src/plot_utils.R b/3_visualize/src/plot_utils.R index cf4bf02d7fb5cb15ca2d57ad7ef5b49774fb616a..c7e4cdd42bf08e247dc85f588a77073377358dfa 100644 --- a/3_visualize/src/plot_utils.R +++ b/3_visualize/src/plot_utils.R @@ -12,8 +12,11 @@ #' @param font_size, set font size #' @param barheight, set colorbar bar height #' @param barwidth, set colorbar bar width -plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var, percent_leg, viz_config_df, viz_config_pal, width, height, font_size, - barwidth, barheight){ +#' @param lim_vals, set legend limits +#' @param break_vals, set legend breaks +plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var, + percent_leg, viz_config_df, viz_config_pal, width, height, + font_size, barwidth, barheight, lim_vals, break_vals){ font_legend <- viz_config_df$load_font font_add_google(font_legend) @@ -55,8 +58,8 @@ plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var, scale_fill_gradientn( colors = colorRampPalette(c("#F8F9FF", viz_config_pal))(100), name = leg_title, - limits = c(0, 100), - breaks = c(0, 25, 50, 75, 100), + limits = lim_vals, # c(0, 100), + breaks = break_vals, # c(0, 25, 50, 75, 100), na.value="#F5F5F5" ) } diff --git a/src/assets/images/perc_disabled_census_2022.png b/src/assets/images/perc_disabled_census_2022.png index e27f7b3f58a2566405c4fe1915bac7d788802c85..f3760573fc1f9355f809be38749a534a24dba56b 100644 Binary files a/src/assets/images/perc_disabled_census_2022.png and b/src/assets/images/perc_disabled_census_2022.png differ