3D Plot Title Issue (Makie.jl)

I have some simple code to plot the earth in 3D using Makie.jl

using GLMakie, FileIO, Colors, GeometryBasics # Plot related libraries

# Earth Image
const earth_img = load(download("https://svs.gsfc.nasa.gov/vis/a000000/a002900/a002915/bluemarble-2048.png"));

# Constants
const R⨁ = 6371. # [km] Earth Mean Radius

 f, lscene = mesh(
    Sphere(Point3f0(0), R⨁),
    color = earth_img,
    shading = true
    # axis = (title="Earth 3D", xlabel = "Xᵢ (km)", ylabel = "Yᵢ (km)", zlabel = "Zᵢ (km)" )
  );
  axis = lscene.scene[OldAxis];
  axis[:names, :axisnames] = ("Xᵢ (km)", "Yᵢ (km)", "Zᵢ (km)");
  axis.title = "Earth 3D";
f

I have been struggling to get a simple title showing on my plot using the LScene() output from mesh. If I use Figure(), then Axis3(title=“MyTitle”) this works, however I’m loosing the zooming & translation features on the plot, which is unwanted.

I also tried the method commented in the mesh() method which doesn’t work either.

Anyone have an idea why the OldAxis method for setting title doesn’t work using LScene() ?

LScene has no title, it’s very bare-bones. You can put a label in the upper protrusion of the layout cell by doing Label(f[1, 1, Top()], "my title", padding = (0, 0, 5, 0))

Thanks for the tip, took me 1 hour to search for a solution. I’m not a fan of just appending a label in an ad-hoc manner, I’d rather use a built-in functionality.

That said I have an other method that works as well:

  f = Figure()
  ax = Axis3(
        f[1,1],
        title="3D Earth",
        xlabel = "Xᵢ (km)",
        ylabel = "Yᵢ (km)",
        zlabel = "Zᵢ (km)",
        aspect = :data
  );

  # Earth 3D Plot
  mesh!(
    Sphere(Point3f0(0), R⨁),
    color = earth_img,
    shading = true
  );
f

This works, however I’m loosing the ability to zoom and translate the plot (the rendering also looks different), any idea why that would be the case?

Axis3 currently deliberately doesn’t have these features because the axis is carefully adjusted to fit in its layout cell, which zooming and panning would mess up. The focus is more on the 3d axis looking good and fitting well together with Axis, rather than having maximum interactive freedom.

Thanks, so there is 2 different way of rendering a 3D plot inside mesh(), and not everything works the same, is there a consistent way of choosing which method to use with the same code structure?