Hi!
The levels
keyword of surface
is useful:
fig = Figure()
xs = LinRange(0, 20, 50)
ys = LinRange(0, 15, 50)
zs = [cos(x) * sin(y) for x in xs, y in ys]
ax, hm = contourf(fig[1, 1], xs, ys, zs,
colormap = :Spectral, levels = [-1, -0.5, -0.25, 0, 0.25, 0.5, 1])
Colorbar(fig[1, 2], hm)
display(fig)
What I’d like to do is the same but now for a scatterplot where the marker color is the colorbar. Using levels
with scatter
errors:
fig = Figure()
xs = LinRange(0, 20, 50)
ys = LinRange(0, 15, 50)
zs = [cos(x) * sin(y) for (x,y) in zip(xs, ys)]
ax, hm = scatter(fig[1, 1], xs, ys; color = zs, colormap = :Spectral, levels = [-1, 0, 1])
Colorbar(fig[1, 2], hm)
display(fig)