test_that("plot_gdd works", {
# Load test data
test_data <- system.file("testdata/test_data_365days.Rds",
package = "smpds") %>%
readr::read_rds() %>%
smpds::gdd()
test_plot <- smpds::plot_gdd(test_data, show_plot = FALSE)
# Expected output
expected_t1 <-
structure(
list(
fill = c("#2B83BA", "#ABDDA4", "#FFFFBF", "#FDAE61", "#D7191C"),
x = c(
25.3413888888889,
25.3275,
25.3275,
25.3408333333333,
25.3372222222222
),
y = c(
42.7411111111111,
42.7555555555556,
42.76,
42.7205555555556,
42.7244444444444
),
PANEL = structure(c(1L,
1L, 1L, 1L, 1L), levels = "1", class = "factor"),
group = structure(1:5, n = 5L),
shape = c(21, 21, 21, 21, 21),
colour = c("black", "black",
"black", "black", "black"),
size = c(1, 1, 1, 1, 1),
alpha = c(NA,
NA, NA, NA, NA),
stroke = c(0.1, 0.1, 0.1, 0.1, 0.1)
),
row.names = c(NA,-5L),
class = "data.frame"
)
expect_equal(ggplot2::layer_data(test_plot, 2),
expected_t1)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.