I have a function that creates a Makie (CairoMakie) plot and returns its figure object.
Occasionally, I need to modify some of the figure settings (e.g. axis limits) after this function is executed and the figure object is returned to REPL, but don’t want to pass them as input arguments to this plotting function. The returned figure object may contain multiple axes and I just can’t figure out how to get the handle to a specific axis from the figure object. There must be a straightforward way to do this, right?
Thanks,
Hanshin
using GLMakie
fig = Figure()
ax = Axis(fig[1,1])
t=0:.01:1
plot!(ax, t, sin.(2π.*t))
ax=Axis(fig[2,1])
plot!(ax, t, cos.(2π.*t))
# the axes can be accessed through the content member of the figure
ylims!(fig.content[1], -3, 3)
Yeah fig.content is just a way to keep track of the Blocks in the figure in the order they were created in. The layouts themselves store the arrangement and as layouts are not matrices, there’s also no matrix storage anywhere.