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
|
x := x
|
||||||
y := y
|
y := y
|
||||||
seriestype := :scatter
|
seriestype := :scatter
|
||||||
|
@series begin
|
||||||
|
()
|
||||||
|
end
|
||||||
@series begin
|
@series begin
|
||||||
seriestype := :path
|
seriestype := :path
|
||||||
label := ""
|
label := ""
|
||||||
primary := false
|
primary := false
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
|
primary := false
|
||||||
()
|
()
|
||||||
end
|
end
|
||||||
@deps scatterpath path scatter
|
@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
|
@specialize
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user