Qu

scatter

Builtin index · Plotting

scatter(x, y)

Input: x, y · Output: no output

What it is

Same machinery as plot — x, y are equal-length Vecs of numbers — but defaults its marker to "o" (dots) instead of "line".

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
scatter(x, y)
x Vec or numbernot documented yet
y Vec or numbernot documented yet
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.

x = [0, 2, 4, 6, 8, 10]
y = [0, 1.8, 1.2, 3.5, 3.0, 4.8]
xq = 0 to 10 step 0.1
plot(xq, interp1(x, y, xq, "linear"))
scatter(x, y)
output
· plot: figure 43 (101 points)
· scatter: figure 44 (6 points)
-1 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 10 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 -1 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 10 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8

from plotting

x = [0, 2, 4, 6, 8, 10]
y = [0, 1.8, 1.2, 3.5, 3.0, 4.8]
xq = 0 to 10 step 0.1
plot(xq, interp1(x, y, xq, "spline"))
scatter(x, y)
output
· plot: figure 45 (101 points)
· scatter: figure 46 (6 points)
-1 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 10 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 -1 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 10 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8

from plotting

x = [0, 2, 4, 6, 8, 10]
y = [0, 1.8, 1.2, 3.5, 3.0, 4.8]
xq = 0 to 10 step 0.1
plot(xq, interp1(x, y, xq, "nearest"))
scatter(x, y)
output
· plot: figure 47 (101 points)
· scatter: figure 48 (6 points)
-1 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 10 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 -1 0 1 2 3 4 5 0 1 2 3 4 5 6 7 8 9 10 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8 x=0, y=0 x=2, y=1.8 x=4, y=1.2 x=6, y=3.5 x=8, y=3 x=10, y=4.8

from plotting

panel(2, 2, 1)
plot(t, y)
panel(2, 2, 2)
plot(f, mag)
panel(2, 2, 3)
scatter(y, yhat)
panel(2, 2, 4)
plot(losses, color="orange")
output
· plot: figure 53 (6 points)
· plot: figure 54 (200 points)
· scatter: figure 55 (500 points)
· plot: figure 56 (40 points)
0 1 2 3 4 5 0 0.3 0.6 0.9 0.1 0.3 0.5 0.7 0.9 0 300 600 900 -0.8 -0.4 0 0.4 0.8 0 2 3 4 x=0, y=0 x=1.8, y=0.063 x=1.2, y=0.126 x=3.5, y=0.188 x=3, y=0.249 x=4.8, y=0.31 0 0.2 0.4 0.6 0.8 1.0 0 10 20 30 40

from plotting

How it works

stair is the only callable spelling: step is already a reserved keyword (to ... step ... ranges), so step(...) can't be a function call — it lexes as a keyword, not an identifier. The rendered marker is internally still "step".

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