I have plotted the variation of concentration with time for a particular chemical. I needed to show the expotential trendline for the data. The data was filtered fom a larger dataset. I used the below code to obtain the trendlines but I am unable to add the equations and r2 value. any help will be appreciated.
dinotefuran <- filter(correlation_analysis,
chemical == "Dinotefuran")
dosage <- c("Single","Single","Single","Single","Single","Single","Single","Single","Single",
"Double","Double","Double","Double","Double","Double","Double","Double","Double",
"Single","Single","Single","Single","Single","Single",
"Double","Double","Double","Double","Double","Double",
"Single","Single","Single","Single","Single","Single","Single","Single","Single",
"Double","Double","Double","Double","Double","Double","Double","Double","Double")
dinotefuran <- data.frame(dinotefuran, dosage)
Plot the variation of concentration in different matrices for Dinotefuran
ggplot(data = dinotefuran) +
geom_point(mapping = aes(x = time_das, y = concentration_mg_by_kg, color = dosage)) +
geom_smooth(mapping = aes(x = time_das, y = concentration_mg_by_kg, color = dosage, group = dosage),
method = "nlsLM",
formula = y ~ a * exp(b * x),
se = FALSE,
linetype = 2,
method.args = list(start = c(a = 0.5, b = 0.2), control = nls.lm.control(maxiter = 100))) +
facet_wrap(~ plant_part, scales = "free") +
labs(title = "Dinotefuran Variation in Plant parts",
x = "Time (d)",
y = "Concentration (mg/kg)") +
design
I tried nls method but it didnt give me the trendlines. I also want to display the confidence interval but when i change se=TRUE the trendlines are not diplayed. For the equations i tried using geom_text and stat_poly_eq but unfortunately neither of those worked.
Arya Alex is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.