Can anyone tell me why this figure is appearing in the corner?

I’m new to GLMakie; I typically use CairoMakie. While the code runs and the plot does appear, it appears at the bottom left corner of the window, invariably. Can anyone tell me why? It feels like it might be something obvious.

using LinearAlgebra, GLMakie, Colors, GeometryBasics

GLMakie.activate!()
GLMakie.closeall()

rect_mesh = GeometryBasics.Rect3(GeometryBasics.Point3f(-0.5), GeometryBasics.Vec3f(1))
rect_thin = GeometryBasics.Rect3(GeometryBasics.Point3f(-1), GeometryBasics.Vec3f(2,2,0.25))
rect_Mesh = GeometryBasics.mesh(rect_mesh)
rect_Thin = GeometryBasics.mesh(rect_thin)

color_map = GLMakie.resample_cmap(:Spectral_11, 3*length(rect_Mesh.position))
colors1 = [color_map[i] for i in 1:3*length(rect_Mesh.position)]
colors2 = repeat([RGBA(rand(4)...) for v in rect_Thin.position], 3)

with_theme(theme_dark()) do
    fig = Makie.Figure(size =(600, 600))
    ax = Makie.Axis3(fig, viewmode = :fit)
    Makie.mesh!(ax, rect_thin; color = colors2, shading = NoShading)
    fig
end

because you need to tell it where to sit, namely, ax = Makie.Axis3(fig[1,1], viewmode = :fit). Note the fig[1,1], bit!

2 Likes
2 Likes

Thank you kindly!