Merge pull request #3423 from matthieugomez/master

correct scatterpath + add linearfit
This commit is contained in:
Daniel Schwabeneder 2021-04-10 12:58:26 +02:00 committed by GitHub
commit 6376d40ae2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -165,16 +165,44 @@ end
x := x
y := y
seriestype := :scatter
@series begin
()
end
@series begin
seriestype := :path
label := ""
primary := false
()
end
primary := false
()
end
@deps scatterpath path scatter
# ---------------------------------------------------------------------------
# regression line and scatter
# plots line corresponding to linear regression of y on a constant and x
@recipe function f(::Type{Val{:linearfit}}, x, y, z)
x := x
y := y
seriestype := :scatter
@series begin
()
end
@series begin
y := mean(y) .+ cov(x, y) / var(x) .* (x .- mean(x))
seriestype := :path
label := ""
primary := false
()
end
primary := false
()
end
@specialize