Skip to content

Commit

Permalink
- Replace Series and Moving with Mean and 7 Day in gss_plot().
Browse files Browse the repository at this point in the history
  • Loading branch information
joethorley committed Apr 22, 2024
1 parent c1a681f commit 126af7b
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions R/gss-plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ gss_plot <- function(
pick = pick,
msgs = msgs)

moving <- paste(window_width, "Day")

rollmean <- .roll_mean(
x,
start_date = start_date,
end_date = end_date,
window_width = window_width) |>
dplyr::mutate(series = "Moving") |>
dplyr::mutate(series = moving) |>
dplyr::filter(!is.na(.data$temperature))

start_end_temperature <- tibble::tibble(
Expand All @@ -67,7 +69,7 @@ gss_plot <- function(
.data$dayte <= dttr2::dtt_dayte(end_date, start_date)) |>
dplyr::mutate(series = "Daily") |>
dplyr::bind_rows(rollmean) |>
dplyr::mutate(series = factor(.data$series, c("Daily", "Moving")))
dplyr::mutate(series = factor(.data$series, c("Daily", moving)))

range <- range(data$temperature, na.rm = TRUE)
gss$ymin <- min(c(0, range[1]))
Expand All @@ -83,8 +85,9 @@ gss_plot <- function(
ggplot2::scale_x_date("Date", date_labels = "%b", date_breaks = "month") +
ggplot2::scale_y_continuous("Water Temperature (C)") +
ggplot2::scale_linetype_manual("Threshold", values = c("dotdash", "dashed")) +
ggplot2::scale_color_manual("Series", values = c("#3063A3", "black")) +
ggplot2::scale_color_manual("Mean", values = c("#3063A3", "black")) +
ggplot2::expand_limits(y = 0) +
ggplot2::guides(color = ggplot2::guide_legend(order = 1)) +
NULL

gp
Expand Down
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot8.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/testthat/_snaps/gss-plot/gss_plot9.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 126af7b

Please sign in to comment.