Skip to content
Snippets Groups Projects
3_visualize.R 8.3 KiB
Newer Older
  • Learn to ignore specific revisions
  • source('3_visualize/src/plot_utils.R')
    
      tar_target(
        p3_med_income_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[2]],
          percent_leg = FALSE,
    
          var = 'estimate', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/med_income_census_2022.png",
          pal = "OrRd",
          leg_title = "Median household income\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
    
      tar_target(
        p3_tot_black_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[3]],
          percent_leg = FALSE,
    
          var = 'estimate',
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/tot_black_census_2022.png",
          pal = "OrRd",
          leg_title = "Total Black\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      
      
      tar_target(
        p3_perc_black_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[3]],
          percent_leg = TRUE,
    
          var = 'percent',
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_black_census_2022.png",
          pal = "OrRd",
          leg_title = "Percent Black\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      
      tar_target(
        p3_tot_latino_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[4]],
          percent_leg = FALSE,
    
          var = 'estimate',
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/tot_latino_census_2022.png",
          pal = "OrRd",
          leg_title =  "Total Latino\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      
      tar_target(
        p3_perc_latino_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[4]],
          percent_leg = TRUE,
    
          var = 'percent',
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_latino_census_2022.png",
          pal = "OrRd",
          leg_title = "Percent Latino\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      
      tar_target(
        p3_tot_male_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[5]],
          percent_leg = FALSE,
    
          var = 'estimate',
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/tot_male_census_2022.png",
          pal = "OrRd",
          leg_title =  "Total Male\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      
      tar_target(
        p3_tot_female_png,
        plot_census_map(
    
          census_data = p2_perc_census_acs5_layers_sf[[6]],
          percent_leg = FALSE,
    
          var = 'estimate', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/tot_female_census_2022.png",
          pal = "OrRd",
          leg_title =  "Total Female\n2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
    
      ),
      
      #  Disaggregated maps
      # percent age maps 
      tar_target(
        p3_perc_under_18_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_age_data[[1]],
          percent_leg = TRUE,
          var = 'percent', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_pop_under_18_2022.png",
          pal = "OrRd",
          leg_title =  "Percent of Total Poulation\nUnder 18, 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      tar_target(
        p3_perc_18_24_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_age_data[[2]],
          percent_leg = TRUE,
          var = 'percent', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_pop_under_18-24_2022.png",
          pal = "OrRd",
          leg_title =  "Percent of Total Poulation\n18-24 years, 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      tar_target(
        p3_perc_15_44_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_age_data[[3]],
          percent_leg = TRUE,
          var = 'percent', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_pop_under_15-44_2022.png",
          pal = "OrRd",
          leg_title =  "Percent of Total Poulation\n15-44 years, 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      tar_target(
        p3_perc_60_plus_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_age_data[[4]],
          percent_leg = TRUE,
          var = 'percent', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_pop_under_60_plus_2022.png",
          pal = "OrRd",
          leg_title =  "Percent of Total Poulation\n60 years & plus, 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      # percent income maps 
      tar_target(
        p3_perc_household_income_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_income_data[[1]],
          percent_leg = TRUE,
          var = 'percent', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/perc_household_income_2022.png",
          pal = "OrRd",
          leg_title =  "Percent allocated\nhousehold income\nin the past 12 months, 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      # education related map
      tar_target(
        p3_tot_18_24_highschool_education_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_education_data[[1]],
          percent_leg = FALSE,
          var = 'estimate', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/tot_education_18-24_highschool_2022.png",
          pal = "OrRd",
          leg_title =  "Total population 18-24 years\nHigh school graduate (includes equivalency), 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"
      ),
      tar_target(
        p3_tot_25_plus_highschool_education_map_png,
        plot_census_map(
          census_data = p2_census_acs5sub_education_data[[2]],
          percent_leg = FALSE,
          var = 'estimate', 
          conus_sf = p1_conus_sf, 
          outfile_path = "3_visualize/out/tot_education_25-plus_highschool_2022.png",
          pal = "OrRd",
          leg_title =  "Total population 25 and older\nHigh school graduate (includes equivalency), 2022",
          width = 6,
          height = 4,
          dpi = 300, 
          counties_outline_col = "grey80",
          conus_outline_col = 'grey50',
          bg_col = "white",
          load_font = 'Source Sans Pro',
          font_size = 10
        ),
        format = "file"