Merge pull request #3423 from matthieugomez/master
correct scatterpath + add linearfit
This commit is contained in:
commit
6376d40ae2
@ -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
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user