Qu

scatterfit

Builtin index · Plotting

scatterfit(x, y, [degree])

Input: x, y, degree · Output: no output

What it is

Draws a scatter of equal-length numeric Vecs x, y plus a polyfit trend line. degree (integer, positional, default 1) is the polynomial degree, sampled densely over x's range.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
scatterfit(x, y, [degree])
x VecDraws a scatter of equal-length numeric Vecs x, y plus a polyfit trend line.
y VecDraws a scatter of equal-length numeric Vecs x, y plus a polyfit trend line.
degree optionaldegree (integer, positional, default 1) is the polynomial degree, sampled densely over x's range.
no output—

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

scatterfit(t, y, 2)   # degree-2 polynomial fit through the scatter

xlabel("x")
ylabel("y")

from plotting

How it works

scatterfit(x, y, [degree]) -- scatter points plus a polyfit trend line (default degree 1) sampled over x's range.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.