diff --git a/3_visualize.R b/3_visualize.R index 61c24b1abf3d0cca9f07cd00875e97dd2c0d6cc4..efb267f8e32f7e281d11122a3a303b0dfeed87f8 100644 --- a/3_visualize.R +++ b/3_visualize.R @@ -4,7 +4,7 @@ source('3_visualize/src/plot_utils.R') # For case studies approach: select one demographic characteristic (hispanic/latino), p3_targets <- list( tar_target( - p3_med_income_png, + p3_med_income_png_en, plot_census_map( census_data = p2_perc_census_acs5_layers_sf[[2]], lim_vals = c(0, 155000), @@ -12,7 +12,7 @@ p3_targets <- list( dollar_leg = TRUE, var = 'estimate', conus_sf = p1_conus_sf, - outfile_path = "3_visualize/out/med_income_census_2022.png", + outfile_path = "3_visualize/out/med_income_census_2022_en.png", leg_title = "Median household income, 2022", viz_config_df = p0_viz_config_df, viz_config_pal = p0_viz_config_pal$socioeconomic_status, @@ -25,7 +25,7 @@ p3_targets <- list( format = "file" ), tar_target( - p3_perc_latino_png, + p3_perc_latino_png_en, plot_census_map( census_data = p2_perc_census_acs5_layers_sf[[4]], percent_leg = TRUE, @@ -34,7 +34,7 @@ p3_targets <- list( 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", + outfile_path = "3_visualize/out/perc_hispanic_census_2022_en.png", leg_title = "Percent Hispanic, 2022", viz_config_df = p0_viz_config_df, viz_config_pal = p0_viz_config_pal$demographic_characteristics, @@ -47,7 +47,7 @@ p3_targets <- list( format = "file" ), tar_target( - p3_avg_household_size_png, + p3_avg_household_size_png_en, plot_census_map( census_data = p2_census_acs5sub_household_data[[1]], percent_leg = FALSE, @@ -55,7 +55,7 @@ p3_targets <- list( lim_vals = c(1, 5), var = 'estimate', conus_sf = p1_conus_sf, - outfile_path = "3_visualize/out/avg_household_size_2022.png", + outfile_path = "3_visualize/out/avg_household_size_2022_en.png", leg_title = "Average household size, 2022", viz_config_df = p0_viz_config_df, viz_config_pal = p0_viz_config_pal$demographic_characteristics, @@ -68,7 +68,7 @@ p3_targets <- list( format = "file" ), tar_target( - p3_median_rent_png, + p3_median_rent_png_en, plot_census_map( census_data = p2_census_acs5sub_household_data[[2]], percent_leg = FALSE, @@ -76,7 +76,7 @@ p3_targets <- list( lim_vals = c(0, 3000), var = 'estimate', conus_sf = p1_conus_sf, - outfile_path = "3_visualize/out/median_rent_2022.png", + outfile_path = "3_visualize/out/median_rent_2022_en.png", leg_title = "Median gross rent, 2022", viz_config_df = p0_viz_config_df, viz_config_pal = p0_viz_config_pal$land_tenure, @@ -89,7 +89,7 @@ p3_targets <- list( format = "file" ), tar_target( - p3_perc_disable_png, + p3_perc_disable_png_en, plot_census_map( census_data = p2_census_acs5sub_disability_data[[1]], percent_leg = TRUE, @@ -98,7 +98,7 @@ p3_targets <- list( break_vals = c(0, 10, 20, 30, 40, 50), var = 'estimate', conus_sf = p1_conus_sf, - outfile_path = "3_visualize/out/perc_disabled_census_2022.png", + outfile_path = "3_visualize/out/perc_disabled_census_2022_en.png", leg_title = "Percent disabled, 2022", viz_config_df = p0_viz_config_df, viz_config_pal = p0_viz_config_pal$demographic_characteristics, @@ -109,5 +109,113 @@ p3_targets <- list( barheight = 1 ), format = "file" +), +# Spanish version's of maps ----------------------------------------------- +tar_target( + p3_med_income_png_es, + plot_census_map( + census_data = p2_perc_census_acs5_layers_sf[[2]], + lim_vals = c(0, 155000), + percent_leg = FALSE, + dollar_leg = TRUE, + var = 'estimate', + conus_sf = p1_conus_sf, + outfile_path = "3_visualize/out/med_income_census_2022_es.png", + leg_title = "Media de ingresos por hogar, 2022", + viz_config_df = p0_viz_config_df, + viz_config_pal = p0_viz_config_pal$socioeconomic_status, + width = p0_viz_config_df$width_desktop, + height = p0_viz_config_df$height_desktop, + font_size = p0_viz_config_df$font_size_desktop, + barwidth = 20, + barheight = 1 + ), + format = "file" +), +tar_target( + p3_perc_latino_png_es, + plot_census_map( + census_data = p2_perc_census_acs5_layers_sf[[4]], + percent_leg = TRUE, + dollar_leg = FALSE, + 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_es.png", + leg_title = "Porcentaje de Hispanos, 2022", + viz_config_df = p0_viz_config_df, + viz_config_pal = p0_viz_config_pal$demographic_characteristics, + width = p0_viz_config_df$width_desktop, + height = p0_viz_config_df$height_desktop, + font_size = p0_viz_config_df$font_size_desktop, + barwidth = 20, + barheight = 1 + ), + format = "file" +), +tar_target( + p3_avg_household_size_png_es, + plot_census_map( + census_data = p2_census_acs5sub_household_data[[1]], + percent_leg = FALSE, + dollar_leg = FALSE, + lim_vals = c(1, 5), + var = 'estimate', + conus_sf = p1_conus_sf, + outfile_path = "3_visualize/out/avg_household_size_2022_es.png", + leg_title = "Tamaño promedio de los hogares, 2022", + viz_config_df = p0_viz_config_df, + viz_config_pal = p0_viz_config_pal$demographic_characteristics, + width = p0_viz_config_df$width_desktop, + height = p0_viz_config_df$height_desktop, + font_size = p0_viz_config_df$font_size_desktop, + barwidth = 20, + barheight = 1 + ), + format = "file" +), +tar_target( + p3_median_rent_png_es, + plot_census_map( + census_data = p2_census_acs5sub_household_data[[2]], + percent_leg = FALSE, + dollar_leg = TRUE, + lim_vals = c(0, 3000), + var = 'estimate', + conus_sf = p1_conus_sf, + outfile_path = "3_visualize/out/median_rent_2022_es.png", + leg_title = "Alquiler bruto medio, 2022", + viz_config_df = p0_viz_config_df, + viz_config_pal = p0_viz_config_pal$land_tenure, + width = p0_viz_config_df$width_desktop, + height = p0_viz_config_df$height_desktop, + font_size = p0_viz_config_df$font_size_desktop, + barwidth = 20, + barheight = 1 + ), + format = "file" +), +tar_target( + p3_perc_disable_png_es, + plot_census_map( + census_data = p2_census_acs5sub_disability_data[[1]], + percent_leg = TRUE, + dollar_leg = FALSE, + 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_disabled_census_2022_es.png", + leg_title = "Porcentaje de discapacitados, 2022", + viz_config_df = p0_viz_config_df, + viz_config_pal = p0_viz_config_pal$demographic_characteristics, + width = p0_viz_config_df$width_desktop, + height = p0_viz_config_df$height_desktop, + font_size = p0_viz_config_df$font_size_desktop, + barwidth = 20, + barheight = 1 + ), + format = "file" ) ) \ No newline at end of file