Skip to content

Commit

Permalink
Add updated figure
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Feb 6, 2025
1 parent 7c16664 commit 0a63d79
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions p1/p1project/foundations.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,27 @@ ac_by_year |>

```{r}
# Updated plot with title and legend...
ac_by_year |>
mutate(
`N. crashes per year` = n_crashes,
`Week average` = zoo::rollmean(n_crashes, 7, na.pad = TRUE),
Date = date,
) |>
ggplot(aes(x = Date, y = `N. crashes per year`)) +
geom_point(alpha = 0.1) +
ylim(c(0, NA)) +
# geom_smooth() +
# weekly rolling average
geom_line(aes(Date, `Week average`, colour = "Week average")) +
theme_minimal() +
labs(
colour = "Legend"
) +
scale_colour_manual(values = c("Week average" = "red")) +
ggtitle("Collions/day, 2020 to 2021") +
theme(
legend.position = "bottom"
)
```


Expand Down

0 comments on commit 0a63d79

Please sign in to comment.