
library("tidyverse")
source("color.R")
source("models.R")

vs <- c(0.01, seq(from = 0.2, to = 1.0, by = 0.2))
vh <- c(0.0, 0.165, 0.33)
vN <- seq(from = 2.0, to = 100, by = 2)
vall <- vector()
all <- tibble()

for (s in vs) {
  for (h in vh) {
    for (Ne in vN) {
      d <- 0.5*s*(1.0 - 2.0*h)
      row <- tibble::tibble(s = s,
                    h = h,
                    Ne = Ne,
                    #LC = LC2021(Ne = Ne),
                    #T1 = T1(Ne = Ne, s = s),
                    T2 = T2(Ne = Ne, s = s, h = h),
                    N1 = N1(Ne = Ne, d = d))
      all <- dplyr::bind_rows(all, row)
    }
  }
}

all <- all %>% tidyr::pivot_longer(cols = c(B2, test), names_to = "model")

Legend <- all %>%
  ggplot() +
  geom_line(aes(x = Ne, y = log10(value), color = factor(s), linetype = factor(h)), size = 1.5, alpha = 0.75) +
  scale_color_manual(values = okp) +
  scale_linetype_manual(values = c("solid", "dashed", "dotted")) +
  facet_wrap(. ~ model) +
  theme_minimal() +
  theme (axis.line = element_line(size = 1),
         axis.title = element_text(size = 15),
         axis.text = element_text (size = 10),
         legend.position = "bottom")
