geom_smooth and stat_poly_eq not matching

plot_B <- d_1 %>%
filter(Genotype == "LM19", tr=="32C38C") %>%
arrange(tr) %>%
ggplot(aes(x = Tleaf,
y = ETR,
group = interaction(Genotype, PotSizeumber),
shape = tr,
linetype = tr)) +
geom_point(size = 1.5) +
geom_smooth(method = "lm", formula = y ~ poly(x, 3), se = FALSE,
colour = 'black', linewidth = 0.6) +
facet_wrap(vars(Genotype)) +
stat_poly_eq(method = "lm",
formula = y ~ poly(x, 3),
aes(label = paste(stat(eq.label), stat(adj.rr.label), sep = "~~~~")),
parse = TRUE)

Hello everyone! I've been working on a script to plot individual curves for each replicate (PotSizeumber) using geom_smooth . I intentionally used a 3rd degree polynomial regression to fit the curves. However, when I tried to extract the curve equations using stat_poly_eq , I noticed that the equations provided by stat_poly_eq are not matching with the curves from geom_smooth . I'm wondering if anyone has any insights or ideas as to why this might be happening. Thank you in advance for your help.

Well I have no explanation as to why, but the solution is to use (as in the examples) y ~ poly(x, 3, raw = TRUE)

Thank you so much! That's the solution indeed :wink:

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.