residuals

Dashed drops from each of a fit's own observations to the fitted curve. of: names the fit; omitted, it takes the graph's only fit, and a graph with more than one has to be told which.

residualsNode
Only withxyplane
Four grey readings, a teal fitted line, and orange segments dropping from each reading to the line.Four grey readings, a teal fitted line, and orange segments dropping from each reading to the line.

Residuals draw the vertical differences from a fit to the points it was found from: residuals(of: #trend; colour: orange), or just residuals where the graph holds a single fit.


#Attributes

ofImplicit
The fit to measure from, by its id — residuals(of: #trend). The points drawn are that fit's own. Omitted, it takes the graph's only fit.
Can be written as shorthand: residuals:value
colourAnimatable
Colour.
bluelight-bluedark-blueredlight-reddark-redorangelight-orangedark-orangeyellowlight-yellowdark-yellowteallight-tealdark-tealgreenlight-greendark-greenpinklight-pinkdark-pinkpurplelight-purpledark-purplegreylight-greydark-greyneutralhex(…)rgb(…)
Also written: color
Defaultorange
widthAnimatable
Stroke width.
Default1.5
hiddenAnimatable
Declared but not drawn. Animatable — hidden: true !cue.to{false}(at: 2) reveals it — and unlike a cue, a hidden element still frames the plot, so the axes do not jump when it appears.
Defaultfalse
lock
Keeps the reader from editing this element on an editable: graph. Nothing at all on a graph that is not editable.
Also written: locked
Defaultfalse

#Allowed in

#Examples

Three frames of the first step: four readings and their fitted line, then orange residuals fading in from each reading to the line.Three frames of the first step: four readings and their fitted line, then orange residuals fading in from each reading to the line.
canvas.graph{
    scatter#readings(x: 1, 2, 3, 4; y: 2.0, 2.4, 3.1, 4.8; colour: grey)
    fit#trend(of: #readings; degree: 1; colour: teal)
    cue{
        residuals(of: #trend; colour: orange)
    }(
        in: 1
    )
}
Seven readings with a quadratic fitted through them and a residual from each reading to the curve.Seven readings with a quadratic fitted through them and a residual from each reading to the curve.
canvas.graph{
    scatter#readings(x: 0, 1, 2, 3, 4, 5, 6; y: 5.2, 2.6, 1.3, 0.6, 1.4, 2.9, 5.5; colour: grey)
    fit#trend(of: #readings; degree: 2)
    residuals(of: #trend)
}

Last updated