File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -161,20 +161,51 @@ end
161
161
# path and scatter
162
162
163
163
# create a path from steps
164
+ # see https://github.com/JuliaPlots/Plots.jl/issues/1495
164
165
@recipe function f (:: Type{Val{:scatterpath}} , x, y, z)
165
166
x := x
166
167
y := y
167
168
seriestype := :scatter
169
+ @series begin
170
+ ()
171
+ end
168
172
@series begin
169
173
seriestype := :path
170
174
label := " "
171
175
primary := false
172
176
()
173
177
end
178
+ primary := false
174
179
()
175
180
end
176
181
@deps scatterpath path scatter
177
182
183
+
184
+ # ---------------------------------------------------------------------------
185
+ # regression line and scatter
186
+
187
+ # plots line corresponding to linear regression of y on a constant and x
188
+ @recipe function f (:: Type{Val{:linearfit}} , x, y, z)
189
+ seriestype := :scatter
190
+ x := x
191
+ y := y
192
+ @series begin
193
+ ()
194
+ end
195
+ X = hcat (ones (length (x)), x)
196
+ yhat = X * (X' X \ X' y)
197
+ @series begin
198
+ y := yhat
199
+ seriestype := :path
200
+ label := " "
201
+ primary := false
202
+ ()
203
+ end
204
+ primary := false
205
+ ()
206
+ end
207
+
208
+
178
209
@specialize
179
210
180
211
You can’t perform that action at this time.
0 commit comments