The maze itself is rendered with Makie.image and the agents on top of it with Makie.textlabel, using a custom background shape.
My issue here is that the agents are too big. I would like to be able to specify their size as a function of the dimensions of the image (the ones visible on the axes), so that the font and circle scale with the maze. Instead, what I see when zooming is that the textlabels keep a constant size, which is not the behavior I want (although I understand it for readability purposes).
Does anyone know how to achieve this fixed size?
Minimum working example (where the size is adaptive):
I don’t think textlabel currently has the ability to do text in something other than screen space. But you don’t really need the adaptive machinery of textlabel for what you want. You just want circles with numbers in them, right? So poly and text with markerspace = :data does the job:
f = Figure()
ax = Axis(f[1, 1], aspect = DataAspect())
n = 20
heatmap!(ax, randn(n, n))
x = rand(1:n, n)
y = rand(1:n, n)
poly!(Circle.(Point2d.(x, y), 0.4), color = :white)
text!(
ax,
x,
y;
text = map(string, 1:n),
fontsize = 0.4,
align = (:center, :center),
markerspace = :data,
)
f
Thanks for the suggestions, this seems to be exactly what i need!
Follow up: since I’m working in a grid world, I’d like the grid lines to remain visible on top of the image / heatmap (which will always be black and white). Is there any way to do that using the keyword arguments to image/heatmap ? Or maybe by putting it somehow behind the axis grid lines?