Axis labels in makie.jl 3d plots

I have a very basic question about plotting 3D data using Makie.jl. How to set the axes labels? An MWE is provided below:

using CairoMakie
using Random

fig = scatter(rand(10), rand(10), rand(10))

xlabel!("label-1")
ylabel!("label-2")
zlabel!("label-3")

The above code doesn’t work.

I can probably do something like:

f = Figure()
  ax = Axis3(
        f[1,1],
        xlabel = "label-1",
        ylabel = "label-2",
        zlabel = "label-3",
  );

scatter!(rand(10), rand(10), rand(10))

This works, but I prefer the look of the 3D plot generated from the first piece of code. What’s the way around this? Thanks.

1 Like