R
package ggpmisc
can be used to show equation of lm
model and poly
model on ggplot2
(See here for reference). Wonder how to show nls
model equation results on ggplot2
using ggmisc
. Below is my MWE.
library(ggpmisc)
args <- list(formula = y ~ k * e ^ x,
start = list(k = 1, e = 2))
ggplot(mtcars, aes(wt, mpg)) +
geom_point() +
stat_fit_augment(method = "nls",
method.args = args)
Inspired by the post you linked. Use
geom_text
to add the label after extracting parameters.