FutoMakie

Things I realized about Julia Makie


Project maintained by duke-of-spacingham Hosted on GitHub Pages — Theme by mattgraham

I also have a Futojulia section, for General Julia thingies!

1. Functional layout populating

Let’s say you have two sub-grids within a parent grid:

fig = Figure()

foo = GridLayout()
fig[1, 2] = foo

bar = GridLayout()
foo[1, 1] = bar
baz = GridLayout()
foo[1, 2] = baz

Label(bar, "bar")

Normally if we want to move the content of bar to be where baz is located? we’ll just move bar into baz’s location:

foo[1, 2] = bar

(technically this is putting a Makie.GridLayoutBase.GridLayout into a Makie.GridLayoutBase.GridPosition.)

But if we want this to be functional?

setindex!() is the solution:

setindex!(foo, bar, 1, 1)

References

2. Exception stack

This one is not about Makie, it is about Julia. I don’t care, imagine you’re in the FutoJulia blog.

Let’s say you had a try, and you caught it.

function boom()
  3 + "wtf"
end

try
  boom()
catch e
  @warn "caught!"
end

Great catch. What was the function call stack of the fail?

No idea.

The web mostly says catch_stacktrace(). But it is not working anymore.

Use stacktrace(catch_backtrace())):

try
  boom()
catch e
  @warn "caught!"
  stacktrace(catch_backtrace())
end

Aha! The issue is in boom().

References