Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
vulnerability-indicators
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Water Mission Area
VizLab
vulnerability-indicators
Commits
85f8d567
Commit
85f8d567
authored
10 months ago
by
Azadpour, Elmera
Browse files
Options
Downloads
Patches
Plain Diff
update map col pals and add disable map
parent
620c910e
No related branches found
No related tags found
1 merge request
!28
Accordion updates
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
3_visualize.R
+82
-25
82 additions, 25 deletions
3_visualize.R
3_visualize/src/plot_utils.R
+5
-7
5 additions, 7 deletions
3_visualize/src/plot_utils.R
with
87 additions
and
32 deletions
3_visualize.R
+
82
−
25
View file @
85f8d567
...
...
@@ -15,7 +15,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/med_income_census_2022.png"
,
leg_title
=
"Median household income, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -34,7 +34,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/perc_household_income_2022.png"
,
leg_title
=
"Percent allocated household income\nin the past 12 months, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -54,7 +54,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/tot_latino_census_2022.png"
,
leg_title
=
"Total Latino, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -74,7 +74,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/perc_latino_census_2022.png"
,
leg_title
=
"Percent Latino, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -96,7 +96,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/tot_households_2022.png"
,
leg_title
=
"Total households, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -115,7 +115,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/tot_female_households_2022.png"
,
leg_title
=
"Total female households, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -134,7 +134,7 @@ p3_targets <- list(
outfile_path
=
"3_visualize/out/median_rent_2022.png"
,
leg_title
=
"Median gross rent, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_neg
,
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
,
...
...
@@ -155,7 +155,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_white_2022.png"
,
leg_title
=
"Median Household Income in the Past 12 Months\n(in 2022 Inflation-Adjusted Dollars),\nWhite Householder"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -175,7 +175,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_black_2022.png"
,
leg_title
=
"Median Household Income in the Past 12 Months\n(in 2022 Inflation-Adjusted Dollars),\nBlack or African American Householder"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -195,7 +195,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_american_indian_2022.png"
,
leg_title
=
"Median Household Income in the Past 12 Months\n(in 2022 Inflation-Adjusted Dollars),\nAmerican Indian and Alaska Native Householder"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -215,7 +215,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_asian_2022.png"
,
leg_title
=
"Median Household Income in the Past 12 Months\n(in 2022 Inflation-Adjusted Dollars),\nAsian Householder"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -235,7 +235,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_hawaiian_2022.png"
,
leg_title
=
"Median Household Income in the Past 12 Months\n(in 2022 Inflation-Adjusted Dollars),\nNative Hawaiian and\n Other Pacific Islander Householder"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -255,7 +255,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_hispanic_2022.png"
,
leg_title
=
"Median Household Income in the Past 12 Months\n(in 2022 Inflation-Adjusted Dollars),\nHispanic or Latino Householder"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
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
,
...
...
@@ -264,6 +264,48 @@ tar_target(
),
format
=
"file"
),
# disability maps
tar_target
(
p3_perc_disable_png
,
plot_census_map
(
census_data
=
p2_census_acs5sub_disability_data
[[
1
]],
percent_leg
=
TRUE
,
var
=
'estimate'
,
conus_sf
=
p1_conus_sf
,
outfile_path
=
"3_visualize/out/perc_disable_census_2022.png"
,
leg_title
=
"Percent disable, 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
=
40
,
barheight
=
2
),
format
=
"file"
),
tar_target
(
p3_total_disable_png
,
plot_census_map
(
census_data
=
p2_census_acs5sub_disability_data
[[
2
]],
percent_leg
=
FALSE
,
var
=
'estimate'
,
conus_sf
=
p1_conus_sf
,
outfile_path
=
"3_visualize/out/tot_disable_census_2022.png"
,
leg_title
=
"Total disable, 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
=
40
,
barheight
=
2
),
format
=
"file"
),
# mobile maps -------------------------------------------------------------
tar_target
(
p3_med_income_mobile_png
,
...
...
@@ -275,7 +317,7 @@ tar_target(
outfile_path
=
"3_visualize/out/med_income_census_2022_mobile.png"
,
leg_title
=
"Median household income, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
viz_config_pal
=
p0_viz_config_pal
$
socioeconomic_status
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -294,7 +336,7 @@ tar_target(
outfile_path
=
"3_visualize/out/perc_household_income_2022_mobile.png"
,
leg_title
=
"Percent allocated household income\nin the past 12 months, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
viz_config_pal
=
p0_viz_config_pal
$
socioeconomic_status
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -303,10 +345,6 @@ tar_target(
),
format
=
"file"
),
# mobile maps -------------------------------------------------------------
tar_target
(
p3_tot_latino_mobile_png
,
plot_census_map
(
...
...
@@ -317,7 +355,7 @@ tar_target(
outfile_path
=
"3_visualize/out/tot_latino_census_2022_mobile.png"
,
leg_title
=
"Total Latino, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
viz_config_pal
=
p0_viz_config_pal
$
demographic_characteristics
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -337,7 +375,7 @@ tar_target(
outfile_path
=
"3_visualize/out/perc_latino_census_2022_mobile.png"
,
leg_title
=
"Percent Latino, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
viz_config_pal
=
p0_viz_config_pal
$
demographic_characteristics
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -356,7 +394,7 @@ tar_target(
outfile_path
=
"3_visualize/out/tot_households_2022_mobile.png"
,
leg_title
=
"Total households, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
viz_config_pal
=
p0_viz_config_pal
$
demographic_characteristics
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -375,7 +413,7 @@ tar_target(
outfile_path
=
"3_visualize/out/tot_female_households_2022_mobile.png"
,
leg_title
=
"Total female households, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_positive
,
viz_config_pal
=
p0_viz_config_pal
$
demographic_characteristics
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -394,7 +432,7 @@ tar_target(
outfile_path
=
"3_visualize/out/median_rent_2022_mobile.png"
,
leg_title
=
"Median gross rent, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
pal_neg
,
viz_config_pal
=
p0_viz_config_pal
$
socioeconomic_status
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
...
...
@@ -402,5 +440,24 @@ tar_target(
barheight
=
3
),
format
=
"file"
)
),
tar_target
(
p3_disable_mobile_png
,
plot_census_map
(
census_data
=
p2_census_acs5sub_disability_data
[[
1
]],
percent_leg
=
TRUE
,
var
=
'estimate'
,
conus_sf
=
p1_conus_sf
,
outfile_path
=
"3_visualize/out/perc_disable_2022_mobile.png"
,
leg_title
=
"Total disable, 2022"
,
viz_config_df
=
p0_viz_config_df
,
viz_config_pal
=
p0_viz_config_pal
$
demographic_characteristics
,
width
=
p0_viz_config_df
$
width_mobile
,
height
=
p0_viz_config_df
$
height_mobile
,
font_size
=
p0_viz_config_df
$
font_size_mobile
,
barwidth
=
40
,
barheight
=
3
),
format
=
"file"
)
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
3_visualize/src/plot_utils.R
+
5
−
7
View file @
85f8d567
...
...
@@ -27,7 +27,7 @@ plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var,
geom_sf
(
data
=
conus_sf
,
fill
=
NA
,
color
=
viz_config_df
$
conus_outline_col
,
linewidth
=
0.
2
,
linewidth
=
0.
5
,
linetype
=
"solid"
)
+
theme_void
()
+
theme
(
text
=
element_text
(
family
=
viz_config_df
$
font_legend
,
size
=
font_size
),
...
...
@@ -44,9 +44,8 @@ plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var,
if
(
percent_leg
==
FALSE
)
{
census_map
<-
census_map
+
scale_fill_distiller
(
palette
=
viz_config_pal
,
direction
=
1
,
scale_fill_gradientn
(
colors
=
colorRampPalette
(
c
(
"#F8F9FF"
,
viz_config_pal
))(
100
),
name
=
leg_title
,
limits
=
c
(
0
,
max
(
census_data
[[
var
]],
na.rm
=
TRUE
)),
labels
=
scales
::
comma
,
...
...
@@ -54,9 +53,8 @@ plot_census_map <- function(census_data, conus_sf, leg_title, outfile_path, var,
}
else
{
census_map
<-
census_map
+
scale_fill_distiller
(
palette
=
viz_config_pal
,
direction
=
1
,
scale_fill_gradientn
(
colors
=
colorRampPalette
(
c
(
"#F8F9FF"
,
viz_config_pal
))(
100
),
name
=
leg_title
,
limits
=
c
(
0
,
100
),
breaks
=
c
(
0
,
25
,
50
,
75
,
100
),
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment