Skip to content
Snippets Groups Projects
3_visualize.R 3.73 KiB
Newer Older
source('3_visualize/src/plot_utils.R')
  tar_target(
    p3_med_income_png,
    plot_census_map(
      census_data = p2_perc_census_layers_sf[[2]],
      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_layers_sf[[3]],
      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_layers_sf[[3]],
      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_layers_sf[[4]],
      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_layers_sf[[4]],
      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_layers_sf[[5]],
      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_layers_sf[[6]],
      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"
  )