Skip to content

Commit

Permalink
add enrollment #s
Browse files Browse the repository at this point in the history
  • Loading branch information
rhirotacouncil committed Apr 16, 2024
1 parent c64b0f4 commit 8e18812
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 22 deletions.
20 changes: 13 additions & 7 deletions code/map_correlation.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
library(ggpubr)
library(htmlwidgets)
# run 01_prepare-data.R first - need school_dist_shp, map_sf
source("code/01_prepare-data.R")

Expand Down Expand Up @@ -49,8 +50,9 @@ p_plot <- ggplot(school_dist_shp,
data_id = school_dis)) +
stat_cor(method="pearson") +
geom_point_interactive(size = (school_dist_shp$total_enrollment)/10000,
aes(tooltip = paste0("<strong>School District: </strong>", school_dis, "<br>",
aes(tooltip = paste0("<strong>District: ", school_dis, "</strong><br>",
"SBHCs: ", num_sbhcs, "<br>",
"Total Enrollment: ", formatC(total_enrollment, format="f", big.mark=",", digits=0), "<br>",
"Poverty: ", round(percent_poverty*100,0), "%"))) +
scale_color_distiller(direction = 1) +
guides(color="none")+
Expand All @@ -74,8 +76,8 @@ map_plot <- girafe(ggobj = p_plot + p_map, width_svg = 10, height_svg = 5.5) %>
#opts_hover(css = "stroke-width: 4; opacity: 1; color:orange"),
opts_toolbar(pngname = "poverty_correlation")
)

htmltools::save_html(map_plot, "visuals/poverty-correlation-map_interactive.html")
map_plot %>%
saveWidget(file = "visuals/poverty-correlation-map_interactive.html")

# ---- Asthma x SBHCs ----

Expand Down Expand Up @@ -107,8 +109,9 @@ a_plot <- ggplot(school_dist_shp,
data_id = school_dis)) +
stat_cor(method="pearson") +
geom_point_interactive(size = (school_dist_shp$total_enrollment)/10000,
aes(tooltip = paste0("<strong>School District: </strong>", school_dis, "<br>",
aes(tooltip = paste0("<strong>District ", school_dis, "</strong><br>",
"SBHCs: ", num_sbhcs, "<br>",
"Total Enrollment: ", formatC(total_enrollment, format="f", big.mark=",", digits=0), "<br>",
"Asthma: ", round(percent_asthma*100,0), "%"))) +
scale_color_distiller(direction = 1) +
guides(color="none")+
Expand Down Expand Up @@ -164,8 +167,9 @@ d1_plot <- ggplot(school_dist_shp,
data_id = school_dis)) +
stat_cor(method="pearson") +
geom_point_interactive(size = (school_dist_shp$total_enrollment)/10000,
aes(tooltip = paste0("<strong>School District: </strong>", school_dis, "<br>",
aes(tooltip = paste0("<strong>District ", school_dis, "</strong><br>",
"SBHCs: ", num_sbhcs, "<br>",
"Total Enrollment: ", formatC(total_enrollment, format="f", big.mark=",", digits=0), "<br>",
"Diabetes 1: ", round(percent_diabetes1*100,2), "%"))) +
scale_color_distiller(direction = 1) +
guides(color="none") +
Expand Down Expand Up @@ -216,7 +220,8 @@ d2_plot <- ggplot(school_dist_shp,
data_id = school_dis)) +
stat_cor(method="pearson") +
geom_point_interactive(size = (school_dist_shp$total_enrollment)/10000,
aes(tooltip = paste0("<strong>School District: </strong>", school_dis, "<br>",
aes(tooltip = paste0("<strong>District ", school_dis, "</strong><br>",
"Total Enrollment: ", formatC(total_enrollment, format="f", big.mark=",", digits=0), "<br>",
"SBHCs: ", num_sbhcs, "<br>",
"Diabetes 2: ", round(percent_diabetes2*100,2), "%"))) +
scale_color_distiller(direction = 1) +
Expand Down Expand Up @@ -268,7 +273,8 @@ an_plot <- ggplot(school_dist_shp,
data_id = school_dis)) +
stat_cor(method="pearson") +
geom_point_interactive(size = (school_dist_shp$total_enrollment)/10000,
aes(tooltip = paste0("<strong>School District: </strong>", school_dis, "<br>",
aes(tooltip = paste0("<strong>District ", school_dis, "</strong><br>",
"Total Enrollment: ", formatC(total_enrollment, format="f", big.mark=",", digits=0), "<br>",
"SBHCs: ", num_sbhcs, "<br>",
"Anaphylaxis: ", round(percent_anaphylaxis*100,0), "%"))) +
scale_color_distiller(direction = 1) +
Expand Down
6 changes: 3 additions & 3 deletions visuals/anaphylaxis-correlation-map_interactive.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions visuals/asthma-correlation-map_interactive.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions visuals/diabetes1-correlation-map_interactive.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions visuals/diabetes2-correlation-map_interactive.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions visuals/poverty-correlation-map_interactive.html

Large diffs are not rendered by default.

0 comments on commit 8e18812

Please sign in to comment.