diff --git a/3_visualize.R b/3_visualize.R index efb267f8e32f7e281d11122a3a303b0dfeed87f8..6a043398b3d345f56ae414e6377478c9bf658fa5 100644 --- a/3_visualize.R +++ b/3_visualize.R @@ -20,7 +20,8 @@ p3_targets <- list( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#fef1f1" ), format = "file" ), @@ -42,7 +43,8 @@ p3_targets <- list( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#eef0ff" ), format = "file" ), @@ -63,7 +65,8 @@ p3_targets <- list( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#eef0ff" ), format = "file" ), @@ -84,7 +87,8 @@ p3_targets <- list( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#ebfaf8" ), format = "file" ), @@ -106,7 +110,8 @@ p3_targets <- list( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#eef0ff" ), format = "file" ), @@ -128,7 +133,8 @@ tar_target( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#fef1f1" ), format = "file" ), @@ -150,7 +156,8 @@ tar_target( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#eef0ff" ), format = "file" ), @@ -171,7 +178,8 @@ tar_target( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#eef0ff" ), format = "file" ), @@ -192,7 +200,8 @@ tar_target( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#ebfaf8" ), format = "file" ), @@ -214,7 +223,8 @@ tar_target( height = p0_viz_config_df$height_desktop, font_size = p0_viz_config_df$font_size_desktop, barwidth = 20, - barheight = 1 + barheight = 1, + low_ramp_col = "#eef0ff" ), format = "file" ) diff --git a/3_visualize/src/plot_utils.R b/3_visualize/src/plot_utils.R index d00542114dd73849d848eb3b445ae35e7db2c1f8..270e09f2edb5170d5ab2fd97b54c84c0bd6fc328 100644 --- a/3_visualize/src/plot_utils.R +++ b/3_visualize/src/plot_utils.R @@ -15,10 +15,11 @@ #' @param barwidth, set colorbar bar width #' @param lim_vals, set legend limits #' @param break_vals, set legend breaks +#' @param low_ramp_col, assign color to low end of color ramp for legend 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, - dollar_leg){ + dollar_leg, low_ramp_col){ font_legend <- viz_config_df$load_font font_add_google(font_legend) @@ -49,7 +50,7 @@ plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var, if (percent_leg == FALSE) { census_map <- census_map + scale_fill_gradientn( - colors = colorRampPalette(c("#eef0ff", viz_config_pal))(100), + colors = colorRampPalette(c(low_ramp_col, viz_config_pal))(100), name = leg_title, limits = lim_vals, labels = if (dollar_leg) scales::label_dollar() else scales::comma,