Makie.xlabel!

Makie.xlabel! has stopped working for me after a recent update. For example,

using Makie
h = Makie.lines(1:10,rand(10))
Makie.xlabel!(h, "label")

produces

ERROR: MethodError: no method matching getindex(::AbstractPlotting.FigureAxisPlot, ::Type{OldAxis})
Stacktrace:
 [1] xlabel!(::AbstractPlotting.FigureAxisPlot, ::String) at C:\Users\ ... \.julia\packages\AbstractPlotting\Gi0Gl\src\shorthands.jl:8
 [2] top-level scope at REPL[5]:1

I’m using Julia 1.5.3 in VSCode on Windows 10 with Makie v0.12.0. I’ve tried uninstalling and reinstalling Makie. It was all fine a couple of weeks ago. Is it likely to be a problem with Makie or just my installation?
Thanks
Tony

3 Likes

It seems I can set the xlabel by

h.axis.xlabel = "jgjg"

but I still can’t get xlabel! to work.

So xlabel! still doesn’t work as one would expect in Makie. What’s going on? When running xlabel("test label"), this error is returned.


MethodError: no method matching xlabel!(::String)

Closest candidates are:

xlabel!(::Any, !Matched::AbstractString)

Seems like a bug in either the documentation or the implementation. It may be worth it to open an issue in the github repository GitHub - JuliaPlots/Makie.jl: High level plotting on the GPU.

1 Like

I still hit this error from time to time, so here is the recommended way:

using CairoMakie
fig, ax, plot = lines(1..10, rand(10); axis = (; xlabel = "x label"))
# or alternatively
ax.ylabel = "y label"
1 Like