Skip to content

Commit

Permalink
Fix plot issue
Browse files Browse the repository at this point in the history
  • Loading branch information
sophie-a-lee committed Dec 7, 2021
1 parent ba2e60d commit 8a6eed6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions 01_exploratory_plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ suitable_diff <- ggplot(data = df_suitable_diff) +
ggsave(suitable_diff, filename = "output/era_suit_diff.png")


## State monthly scPDSI set out in shape of Brazil (using grid_br) (Figure M1)
## State monthly scPDSI set out in shape of Brazil (using grid_br) (Fig A in S1 Text)
pdsi_heat <- ggplot(data = df_climate_grid,
aes(x = month, y = year, fill = pdsi)) +
geom_raster() +
Expand Down Expand Up @@ -187,7 +187,7 @@ df_wet <- df_year %>%
st_as_sf()


## Difference in months extremely wet (Figure M2)
## Difference in months extremely wet (Fig B in S1 Text)
# Convert decade df into wide format (variable per decade)
df_wet_diff <- spread(st_drop_geometry(df_wet),
decade, months_wet) %>%
Expand Down Expand Up @@ -652,7 +652,7 @@ first_outbreak20 <- ggplot(data = df_outbreak) +
expand_limits(fill = c(2001, 2020)) +
# Add municipalities without outbreaks to legend
scale_colour_manual(values = NA) +
guides(colour = guide_legend("No outbreaks")) +
guides(colour = guide_legend("No \noutbreaks")) +
theme_void() +
theme(legend.title = element_text(size = 15),
legend.text = element_text(size = 10))
Expand All @@ -669,7 +669,7 @@ first_outbreak10 <- ggplot(data = df_outbreak) +
# Ensure legends are on same scale
expand_limits(fill = c(2001, 2020)) +
scale_colour_manual(values = NA) +
guides(colour = guide_legend("No outbreaks")) +
guides(colour = guide_legend("No \noutbreaks")) +
theme_void() +
theme(legend.title = element_text(size = 15),
legend.text = element_text(size = 10))
Expand All @@ -691,7 +691,7 @@ first_outbreak_decade <- plot_grid(first_outbreak_decade, outbreak_leg,


ggsave(first_outbreak_decade, filename = "output/first_outbreak_decade.png",
height = 5, width = 10)
height = 5, width = 12)


#### Plot 75th percentile outbreak threshold (Figure M) ####
Expand Down
6 changes: 3 additions & 3 deletions 03_model_output.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ model_aeg <- readRDS("output/model_aeg.rds")
model_wet <- readRDS("output/model_wet.rds")


## Sensitivity analysis - remove each variable in turn
## Sensitivity analysis - add each variable in turn
model_temp <- readRDS("output/model_temp.rds")
model_prior <- readRDS("output/model_prior.rds")
model_urb <- readRDS("output/model_urb.rds")
Expand Down Expand Up @@ -230,8 +230,8 @@ spat_est01.full <- spat_est.full[df_model$year == 2001, ]
mean_spat.full <- apply(spat_est01.full, 1, mean)

# Create 95% credible interval by taking 2.5th and 97.5th percentiles
lci_spat.full <- apply(spat_est01.full, 1, quantile, probs=0.025)
uci_spat.full <- apply(spat_est01.full, 1, quantile, probs=0.975)
lci_spat.full <- apply(spat_est01.full, 1, quantile, probs=0.025, na.rm = T)
uci_spat.full <- apply(spat_est01.full, 1, quantile, probs=0.975, na.rm = T)


# Join random effects to model df + plot on a map
Expand Down

0 comments on commit 8a6eed6

Please sign in to comment.