Skip to content

xlabel! and ylabel! do not behave as expected #1808

@czimm79

Description

@czimm79

When using xlabel! or ylabel! to set axis labels according to the docstring, Makie throws a method error.

using CairoMakie

lines(0:0.1:2π, sin)
xlabel!("My X Label")
MethodError: no method matching xlabel!(::String)

Closest candidates are:

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

In the source, xlabel! requires a scene positional argument. This conflicts with the docstring which specifies it as optional.

https://github.com/JuliaPlots/Makie.jl/blob/84a026f5a59ee71df50f2486be89da27a41af82d/src/shorthands.jl#L7-L18

From the documentation, it seems like scenes where phased out in favor of Figures. Also this discourse post further describes the same issue.

If this is a valid issue, I don't mind creating a draft pull request simply implementing a method for xlabel!(xlabel::AbstractString).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Axisrelated to `Axis()` objectsAxis3related to Axis3MakieBackend independent issues (Makie core)User Interfacefunctionality users interface withenhancementFeature requests and enhancementsold vs new

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions