using CairoMakie
xs = collect(range(1,stop=5))
ys = collect(range(1,stop=5))
zs = [cos(x) * sin(y) for x in xs, y in ys]
fig, ax, hm = heatmap(xs, ys, grid)
Colorbar(fig[:, end+1], hm)
Yea, so I think there’s a couple things going on here. The merged look is coming from the two separate axes that are being set up (one from fig, ax, hm = ..., and the other from ax = Axis(...)), so I would just pick one and go with that. If we go with the first way, we can pass a special keyword arg
The other thing that I think is going on is that aspect = 1 will take care of the aspect ratio of the axis for us, but the figure will still need some special care to get right. There is a really nice way to do this that was recently added that I think @jacobusmmsmit was referring to, so I might try something like this:
xs = 1:5 # Don't think we need to collect here, a UnitRange should be fine
ys = 1:5
grid1 = rand(Float16, 5, 5)
grid2 = rand(Float16, 5, 5)
grid = grid1/grid2
fig, ax, hm = heatmap(xs, ys, grid;
axis = (xlabel="X", ylabel="Y"),
colormap = :bwr,
)
Colorbar(fig[:, end+1], hm)
colsize!(fig.layout, 1, Aspect(1, 1.0))
resize_to_layout!(fig)
fig