heatmap
seems like the way to go to me. If your a
and b
spanned the entire lattice, I would just use reshape
to, well, reshape c
. This is not your case here, so one solution is to fill the lattice with NaN
s where you have no value. E.g.,
using Plots
a = [1, 2, 3, 1, 2, 3, 1, 2]
b = [1, 1, 1, 2, 2, 2, 3, 3]
c = [1, 5, 4, 3, 4, 2, 1, 3]
x, y = sort(unique(a)), sort(unique(b)) # the lattice x and y
C = fill(NaN, length(y), length(x)) # make a 2D C with NaNs
for (i,j,v) in zip(a,b,c) # fill C with c values
C[j,i] = v
end
heatmap(x, y, C, clims=(0,5)) # success!
gives
EDIT: If you want to specify the edges of the cells, you can do this with heatmap
, and if you want lines, you can add them manually I guess, for example with vline
and hline
?
ex, ey = [0, 1.5, 2.3, 4], [0.5, 1.5, 2.5, 3.5]
heatmap(ex, ey, C, clims=(0,5))
vline!(ex, c=:black)
hline!(ey, c=:black)
will give