Skip to content

Extending recipes with new types doesn't always work #3988

@aplavin

Description

@aplavin

Trying to make a proper recipe for stuff like lines(function) that plot the function over the whole axis x-range. Current hacky implementation at https://github.com/JuliaAPlavin/MakieExtra.jl/blob/master/src/axisfunction.jl.

However, following the docs and defining required functions I still get a conversion error:

function Makie.plot!(p::Lines{<:Tuple{Function}})
    # TODO
end

Makie.convert_arguments(::Type{<:Lines}, f::Function) = (f,)

lines(sin)

# ArgumentError: Conversion failed for MakieCore.Lines (With conversion trait MakieCore.PointBased()) with args: Tuple{typeof(sin)} .
# MakieCore.Lines requires to convert to argument types Tuple{AbstractVector{<:Union{GeometryBasics.Point2, GeometryBasics.Point3}}}, which convert_arguments didn't succeed in.
# To fix this overload convert_arguments(P, args...) for MakieCore.Lines or MakieCore.PointBased() and return an object of type Tuple{AbstractVector{<:Union{GeometryBasics.Point2, GeometryBasics.Point3}}}.`

How to define it properly?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugconversionsMainly `convert_arguments`planningFor discussion and planning developmentrecipes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions