library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.2     ✔ readr     2.1.4
## ✔ forcats   1.0.0     ✔ stringr   1.5.0
## ✔ ggplot2   3.4.2     ✔ tibble    3.2.1
## ✔ lubridate 1.9.2     ✔ tidyr     1.3.0
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
temp.data <- read.csv("../data/temp-experiment.csv", header = TRUE)
temp.data1 <- read.csv("../data/temp-experiment-size2.csv", header = TRUE)
temp.dataa2 <- read.csv("../data/temp-experiment-size-3.csv", header = TRUE)
temp.data3 <- read.csv("../data/temp-experiment-size-3-reformat.csv", header = TRUE)
temp.data1 %>%
ggplot(mapping = aes(x = Temperature, y = SL_mm)) + 
  geom_boxplot()

temp.data1 %>%
ggplot(mapping = aes(x = Temperature, y = SL_11212022)) + 
  geom_boxplot()

temp.data1 %>%
ggplot(mapping = aes(x = Temperature, y = SL_12272022)) + 
  geom_boxplot()

date_levels <- c("SL_11212022", "SL_12272022", "SL_mm")
temp.data3$Date <- factor(temp.data3$Date, levels = date_levels, ordered=TRUE)
temp.data3$Temperature <- factor(temp.data3$Temperature, levels = c("0","5","9","16"))

# overlayed figure
p1 <- ggplot(temp.data3, aes(x = Date, y = value, color = Temperature, group = Microchip_ID)) +
             geom_line() +
             geom_point() +
             labs(x = "Date", y = "Value", color = "Temperature") +
             theme_minimal() +
             theme(legend.position = "top") + 
             scale_color_manual(values = c("darkblue","royalblue1","orangered1","darkred"))

p1

# facet wrapped figure
p2 <- ggplot(temp.data3, aes(x = Date, y = value, color = Temperature, group = Microchip_ID)) +
             geom_line() +
             geom_point() +
             labs(x = "Date", y = "Value", color = "Temperature") +
             # theme_minimal() +
             theme(legend.position = "top") + 
             scale_color_manual(values = c("darkblue","royalblue1","orangered1","darkred")) + facet_wrap(~ Temperature)

p2

# overlayed figure; boxplot
p3 <- ggplot(temp.data3, aes(x = Date, y = value, color = Temperature)) +
             geom_boxplot() +
             labs(x = "Date", y = "Value", color = "Temperature") +
             theme_minimal() +
             theme(legend.position = "top") + 
             scale_color_manual(values = c("darkblue","royalblue1","orangered1","darkred"))

p3

# facet wrapped figure; boxplot
p4 <- ggplot(temp.data3, aes(x = Date, y = value, color = Temperature)) +
             geom_boxplot() +
             labs(x = "Date", y = "Value", color = "Temperature") +
             # theme_minimal() +
             theme(legend.position = "top") + 
             scale_color_manual(values = c("darkblue","royalblue1","orangered1","darkred")) + facet_wrap(~ Temperature)

p4