Hi everyone,
I am trying to plot an inset inside of a heatmap and would like a semi-transparent background for the inset to make the line more visible.
However, it seems that all “background” attributes (i.e. axis ticks and background coloring) of the inset are overruled by the heatmap plot.
Here is a MWE that shows this problem, as you can see in the plot below, the inset actually works but its attributes need to be moved to the top layer.
How can this be done?
using CairoMakie
x = y = -5:1:5
z = [x^2 + y^2 for x in x, y in y]
fig = Figure(resolution = (600, 400))
ax = Axis(fig[1, 1]; aspect = 1)
hmap = heatmap!(x, y, z,)
inset_ax = Axis(fig[1,1],
width=Relative(0.8),
height=Relative(0.2),
halign=0.5,
valign=0.1,backgroundcolor = (:red,0.4)
)
lines!(inset_ax,1:10
)
display(fig)