Dear all,
I was wondering which is the best way to set the location of a colorbar (associated to a heatmap) with makie.
I have tried the bbox
argument without success. There is also the translate!
function but it does not seem to apply to a colorbar.
I am basically trying to make a colorbar as inset (like what’s done with line plots there ).
I append (always the same :D) MWE below. I’d like to place the colorbar in the purple space located for x>1.5.
Cheers!
# Mesh
x = LinRange(-1.0, 3, 200)
y = LinRange(-2.0, 2.0, 100)
Lx, Ly = x[end]-x[1], y[end]-y[1]
# One continuous field
f = 1e3.*exp.(-x.^2 .- (y').^2)
# One discontinuous field
g = zero(f)
g[(x.^2 .+ (y.^2)') .< 0.5^2] .= 1.0
# Compose figure
fig = Figure(resolution = (600, 600), fontsize = 22, fonts = (;regular="CMU Serif"))
ax = fig[1, 1] = Axis(fig, xlabel = L"x", ylabel = L"y", aspect=Lx/Ly)
hm = GLMakie.heatmap!(ax, x, y, f, colormap = (:plasma))
GLMakie.contour!(ax, x, y, g)
GLMakie.Colorbar(fig[1, 2], hm, label = L"\log_{10}[(u^2+v^2)^{1/2}]", width = 20,
labelsize = 14, ticklabelsize = 14, bbox=BBox(500, 550, 100, 500))
DataInspector(fig)
display(fig)