Skip to content

Commit

Permalink
add zeros to marine heatwave plot
Browse files Browse the repository at this point in the history
  • Loading branch information
kimberly-bastille committed Nov 29, 2022
1 parent 7143334 commit 71b3ec1
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions chapters/temperature_clims.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,26 @@ gom
#### Cumulative and Maximum Marine Heatwaves

```{r,, echo = FALSE, message = FALSE, warning = FALSE, fig.cap=""}
cumu <- ecodata::heatwave %>%
df<- data.frame(EPU = c(rep(c("GB"), 40),
rep(c("GOM"), 40),
rep(c("MAB"), 40)),
Time = rep(c(1982:2021), 3),
Value = c(0),
Var = rep(c("cumulative intensity",
"maximum intensity"), 60),
Units = c("NA"))
filled<- plyr::rbind.fill( df, ecodata::heatwave) %>%
group_by(Time, EPU, Var) %>%
filter(Value == max(Value))
cumu <- filled %>%
dplyr::filter(Var == "cumulative intensity") %>%
dplyr::mutate(Var = recode(Var, "cumulative intensity" = "Cumulative Intensity (degree C x days)"))
maxin <- ecodata::heatwave %>%
maxin <- filled %>%
dplyr::filter(Var == "maximum intensity") %>%
dplyr::group_by(Time, EPU, Var, Units) %>%
dplyr::summarise(Value = max(Value)) %>%
Expand All @@ -142,12 +157,18 @@ hw<- cumu %>%
dplyr::mutate(hline = mean(Value),
ltm = "82-11")
cumu9120 <- read.csv(here::here("data-raw/heatwave_9120.csv")) %>%
dat<- read.csv(here::here("data-raw/heatwave_9120.csv"))
filled2<- plyr::rbind.fill( df,dat) %>%
group_by(Time, EPU, Var) %>%
filter(Value == max(Value))
cumu9120 <- filled2 %>%
dplyr::filter(Var == "cumulative intensity") %>%
dplyr::mutate(Var = recode(Var, "cumulative intensity" = "Cumulative Intensity (degree C x days)")) %>%
dplyr::select(!X)
maxin9120 <- read.csv(here::here("data-raw/heatwave_9120.csv")) %>%
maxin9120 <- filled2 %>%
dplyr::filter(Var == "maximum intensity") %>%
dplyr::group_by(Time, EPU, Var, Units) %>%
dplyr::summarise(Value = max(Value)) %>%
Expand Down Expand Up @@ -184,6 +205,8 @@ hw %>% rbind(hw9120) %>%
face = "italic"),
axis.title.y = element_text(angle = 90))+
ecodata::theme_title()
```


0 comments on commit 71b3ec1

Please sign in to comment.