examples/plot_weather_example.R

library(ggplot2)
library(dplyr)
data(weather_mittadalen)

weather_2019 <- weather_mittadalen %>%
  dplyr::filter(year == 2019)

weather_condition_2019 <-
  with(weather_2019, analyze_weather(date, snow_depth, prec, temp_min, temp_max,
                                     temp_avg, start = "first_permanent_snow",
                                     plot_first_snow = T))

plot_weather(weather_condition_2019, term = c("snow_depth", "precip"))
plot_weather(weather_condition_2019, term = c("snow_de", "cum"))
plot_weather(weather_condition_2019, term = c("snow_de", "cum"), add_events = "events3")
plot_weather(weather_condition_2019, term = c("snow_de", "cum", "snow_prec_ratio"))
plot_weather(weather_condition_2019, term = c("snow_de", "cum", "snow_prec_ratio"),
             factor_mult = c(1,1,100))
plot_weather(weather_condition_2019, term = c("snow_de", "cum", "snow_prec_ratio"),
             factor_mult = c(.01,.01,1), add_events = "events3")

# configure details in your plot using further ggplot2 functions
plot_weather(weather_condition_2019, term = c("snow_de", "cum"), add_events = "events3") +
  theme_bw() +
  theme(legend.position = "bottom") +
  labs(y = "Weather variable value")
bniebuhr/witch documentation built on Dec. 31, 2020, 8:56 p.m.