From 98764877ad758e30642dfaa404b364143990f5b0 Mon Sep 17 00:00:00 2001 From: "Azadpour, Elmera" <eazadpour@usgs.gov> Date: Tue, 10 Sep 2024 09:57:08 -0700 Subject: [PATCH] update low col hex --- 3_visualize.R | 30 ++++++++++++++++++++---------- 3_visualize/src/plot_utils.R | 5 +++-- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/3_visualize.R b/3_visualize.R index efb267f..6a04339 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 d005421..270e09f 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, -- GitLab