heatmap

heatmap(x, y, values)
heatmap(values)              

Plots a heatmap as an image on x, y (defaults to interpretation as dimensions).

Two vectors and a matrix

using CairoMakie


xs = range(0, 10, length = 25)
ys = range(0, 15, length = 25)
zs = [cos(x) * sin(y) for x in xs, y in ys]

heatmap(xs, ys, zs)          

Two ranges and a function

using CairoMakie

function mandelbrot(x, y)
    z = c = x + y*im
    for i in 1:30.0; abs(z) > 2 && return i; z = z^2 + c; end; 0
end

heatmap(-2:0.1:1, -1.1:0.1:1.1, mandelbrot,
    colormap = Reverse(:deep))          

Three vectors

There must be no duplicate combinations of x and y, but it is allowed to leave out values.

using CairoMakie


xs = [1, 2, 3, 1, 2, 3, 1, 2, 3]
ys = [1, 1, 1, 2, 2, 2, 3, 3, 3]
zs = [1, 2, 3, 4, 5, 6, 7, 8, NaN]

heatmap(xs, ys, zs)