# ready to make examples
pop <- gen_pop_tpd( N = 50, Topt = 25, CTmax = 28, CTmin = 23, Pmax = 1, Pmin = 0,
Error = 0.01, Samples = 10, Degree = 3)
pop$Parent <- rep(NA, nrow(pop))
a <- gen_tmseq(Tmin = 25, Tmax = 25.05, Nt = 100, Error = 0.1)
# multiple time simulation
trial <- sim_mtime(TPD = pop, Te = a, Sp = 0.9, Rp = 0.65, Mu = 0.001, Mum = 0.05, Musd = 0.01,
Pmin = 0, Error = 0.1, Samples = 10, Degree = 3)
trial_curves <- data.frame(Tm = NA, P = NA, L = NA, U = NA, t = NA)
tre <- trial %>% nest(data = c(ID, Tm, P, Parent))
for(i in 1:nrow(tre)){
# select the time value
which_time <- as.numeric(tre$t[i])
# select a column
time <- tre[i,] %>% unnest(cols = c(data))
# get the tpc
time_tpc <- get_tpc(Tm = time$Tm, P = time$P, Degree = 3, Pmin = 0)
# add the time variable
time_tpc$t <- rep(which_time, nrow(time_tpc))
# bind it to the curve data
trial_curves <- rbind(trial_curves, time_tpc)
}
# plotting the curves
ggplot(data = trial_curves, aes(x = Tm, y = P)) +
geom_line(aes(colour = as.factor(t)), lwd = 1, alpha = 1) +
theme_classic() +
xlim(22,30) +
ylim(0,1.25)
ggplot(data = ps_tt1_tpc, aes( x = Tm, y = P)) +
geom_ribbon(aes(ymin = L, ymax = U, fill = factor(Pop)), alpha = 0.25) +
geom_line(aes(colour = factor(Pop)), lwd = 1.25) +
geom_point(data = ps_tt1, aes(x = Tm, y = P, colour = factor(Pop))) +
theme_classic() +
labs( x = "Temperature", y = "Performance", fill = "Population", colour = "Population") +
theme(legend.position = "top") +
geom_hline( aes( yintercept = 0), lty = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.