Adding a linear or logistic equation to a curve plot

Hello Everyone:

Is there an approach to displaying the
regression equation on a curve plot?

I would like to avoid using PyCall.jl or
SciKitLearn.jl. I am using StatsPlots.jl
with a PlotlyJS backend(). Initially, I
thought there might have been a simple
parameter adjustment (regression-eq= true),
but perhaps it is a little more involved?

Any stable resources out there?

See discussion here: Adding a trendline or line of best fit - #7 by piever

Hello @nilshg:

Thanks for providing this resource. So I will attempt to implement:

@recipe function univariatecalibrationrecipe(rmodel::UnivariateCalibration, X, Y;
                                            decimals = 3, text_location = :topleft)
    Yhat = rmodel.(X)
    seriestype := :scatter
    title := "Univariate Regression Plot"
    xlabel := Symbol("Fitted Values")
    ylabel := Symbol("Residuals")
    label := "Actual Values"
    @series y := (X, Y)
    seriestype := :straightline
    label := "Trend-Line"
    slope, bias, Rsq = string.( round.( [ rmodel.Slope, rmodel.Offset, rmodel.Rsq ], digits = decimals ) )
    @series begin
        annotation := (text_location, "y = " * slope * " x + " * bias * "\n R2 = " * Rsq )
        y := ( [0, 1], [rmodel.Offset, rmodel.Offset + rmodel.Slope])
    end
end

Do I need to add the packages, PlottingTools.jl or Chemometrics.jl
or the function should suffice?

using Plots should suffice I believe!