Y axis doesn't line up with X axis sometimes
JeroenDelcour opened this issue · comments
anscombeA = [
[10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5],
[8.04, 6.95, 7.58, 8.81, 8.33, 9.96, 7.24, 4.26, 10.84, 4.82, 5.68]
]
anscombeB = [
[10, 8, 13, 9, 11, 14, 6, 4, 12, 7, 5],
[9.14, 8.14, 8.74, 8.77, 9.26, 8.10, 6.13, 3.10, 9.13, 7.26, 4.74]
]
# sort by X value
anscombeA = list(zip(*[(x, y) for x, y in sorted(zip(*anscombeA))]))
anscombeB = list(zip(*[(x, y) for x, y in sorted(zip(*anscombeB))]))
fig = Figure(xlabel="x label", ylabel="y label", title="Anscombe", legendloc="bottomright")
fig.scatter(x=anscombeA[0], y=anscombeA[1], label="Anscombe I")
fig.scatter(*anscombeB, label="Anscombe II", marker="+")
fig.show()
Output:
Anscombe
| o
10.0+
| o
9.0+ +
| + + + +
8.0+ o
y | + o +
7.0+ o + o
l | o
a 6.0+
b | +
e 5.0+ o
l | o
4.0+ + +----Legend---+
|o |o Anscombe I |
3.0+ |+ Anscombe II|
+ +-------------+
+----------+----------+-----------+----------+----------+
4.0 6.0 8.0 10.0 12.0 14.0
x label