How can I plot two meshes in Makie within a function?
From the REPL, I can do the following and get a plot with two cubes:
using Makie
A = FRect3D(Vec3f0(0), Vec3f0(1))
B = FRect3D(Vec3f0(1), Vec3f0(1))
s = Scene()
mesh(A, color = :red)
mesh!(B, color = :blue)
However, I can't seem to get it to work when inside a function call:
My attempt:
using Makie
function draw_cubes()
A = FRect3D(Vec3f0(0), Vec3f0(1))
B = FRect3D(Vec3f0(1), Vec3f0(1))
mesh(A, color = :red)
mesh!(B, color = :blue)
end
s=Scene()
draw_cubes()
leaves me with a blank scene, and returns
Combined{AbstractPlotting.mesh,Tuple{GeometryBasics.Mesh{3,Float32,GeometryBasics.Ngon{3,Float32,3,GeometryBasics.PointMeta{3,Float32,Point{3,Float32},(:uv, :normals),Tuple{Vec{2,Float32},Vec{3,Float32}}}},GeometryBasics.FaceView{GeometryBasics.Ngon{3,Float32,3,GeometryBasics.PointMeta{3,Float32,Point{3,Float32},(:uv, :normals),Tuple{Vec{2,Float32},Vec{3,Float32}}}},GeometryBasics.PointMeta{3,Float32,Point{3,Float32},(:uv, :normals),Tuple{Vec{2,Float32},Vec{3,Float32}}},GeometryBasics.NgonFace{3,GeometryBasics.OffsetInteger{-1,UInt32}},StructArrays.StructArray{GeometryBasics.PointMeta{3,Float32,Point{3,Float32},(:uv, :normals),Tuple{Vec{2,Float32},Vec{3,Float32}}},1,NamedTuple{(:position, :uv, :normals),Tuple{Array{Point{3,Float32},1},Array{Vec{2,Float32},1},Array{Vec{3,Float32},1}}},Int64},Array{GeometryBasics.NgonFace{3,GeometryBasics.OffsetInteger{-1,UInt32}},1}}}}}
Commenting out the mesh! line successfully plots the first cube just fine. I just can't get the second.
I've also tried passing the scene to the function, declaring the scene in the function (or using global s), with no luck.
Non-Makie solutions (so long as they are interactive plots), are fine as answers too... but I would like to figure out where I went wrong.
(I'm using Julia Version 1.5.3 (2020-11-09); Makie v0.12.0)
