USF-IMARS / seus-mbon-cruise-ctd-processing

CTD processing & reporting for the SEUS MBON research cruise data
https://usf-imars.github.io/seus-mbon-cruise-ctd-processing/
0 stars 0 forks source link

Change to "plot across all stations" #2

Open sebastiandig opened 5 months ago

sebastiandig commented 5 months ago

@7yl4r

cruise_report_template.qmd#L80

Issue

From the issues in Frank's email about "plot across all stations":

Possible Update

starting on line 81: cruise_report_template.qmd#L80 you may need to test the result before proceeding.

  1. fix stacking issue
    • geom_col() + to geom_col(position = position_dodge(preserve = "single")) +
    • position_dodge(preserve = "single") this removes the stacking effect to be next to each other
  2. reverse depth to start with 0 m at the top
    • scale_y_reverse() +
    • this just makes 0 depth at the top
    • this can be added after labs() or theme_minimal()

example to see the difference:

librarian::shelf(
  quiet = TRUE,
  librarian,
  ggplot2, lubridate, tibble, dplyr
  )

test_data <- 
  tibble(
  date    = c(rep("2020-01-01", 20), rep("2020-01-10", 10)), 
  station = rep(c("stn1", "stn2", "stn3"), each = 10), 
  value   = rep(1:10, 3)
) |>
  mutate(
    date = as_date(date)
  )

# original:
ggplot(test_data, aes(x = date, y = value, fill = station)) +
  geom_col()

# updated:
ggplot(test_data, aes(x = date, y = value, fill = station)) +    
  geom_col(position = position_dodge(preserve = "single")) + # <--- fix stacking
  scale_y_reverse()                                          # <--- reverse depth