Just add the mapping aes(group=Species)to the call geom_smooth().
The main plot:
library(ggplot2); theme_set(theme_bw())
g0 <- ggplot(data = iris, aes(x = Sepal.Length, y = Petal.Length)) +
geom_point(aes(color = Species))
geom_smooth:
g0 + geom_smooth(aes(group=Species),
method = "nls", formula = y ~ a * x + b, se = FALSE,
method.args = list(start = list(a = 0.1, b = 0.1)))
If you add color matching (for a factor variable) that will have the same effect, plus the lines will be colored accordingly.
g0 + geom_smooth(aes(colour=Species),
method = "nls", formula = y ~ a * x + b, se = FALSE,
method.args = list(start = list(a = 0.1, b = 0.1)))
@HubertL, , ggplot...
, , nls - geom_smooth(...,method="lm") ...