MethodError: no method matching lift(::typeof(tuple))

I’m trying to use Plot Recipes in Makie.

To do so, I’ve been trying to create a smallest example (which does nothing) by reading Plot Recipes. Because, although It works like a charm, the stock chart example is a bit too complex to start with.

And this is what I came up with.

using GLMakie
using Makie

@recipe(MyPlot) do scene
    Theme(
        plot_color = :red
    )
end

function Makie.plot!(myplot::MyPlot)
    myplot
end

f = Figure()
myplot(f[1,1])

Unfortunately, this gives me MethodError: no method matching lift(::typeof(tuple)).

What do I need to make the smallest recipe work?

My investigation so far:
I’ve searched lift() in Makie and found that plot!() has it at line 309 to create an Observable for onany(). But the lift() has a variable called tuple, which I have no idea where it came from.

In fact, lift() seems to be used many other places in Makie. I assume I need to read Observables & Interaction.

But in the Stock chart example, I only see this:

colormap = lift(Any, sc.downcolor, sc.upcolor) do dc, uc
    [dc, uc]
end

I’m pazzled.

This is because your plot has no input arguments and that is not supposed to happen it seems. The error message comes from lift being called only with a function argument (tuple) but no observables, and I assume this is where usually positional arguments would be processed which you don’t have.

Hi jules,

Thank you for your reply. I’ve added an argument to the my minimal example and now I get

julia> myplot(f[1,1], 1)
ERROR: MethodError: no method matching draw_atomic(::GLMakie.Screen, ::Scene, ::Combined{myplot, Tuple{Int64}})
Closest candidates are:
  draw_atomic(::GLMakie.GLScreen, ::Scene, ::Union{Scatter, MeshScatter}) at ~/.julia/packages/GLMakie/TfSB1/src/drawing_primitives.jl:191
  draw_atomic(::GLMakie.GLScreen, ::Scene, ::Lines) at ~/.julia/packages/GLMakie/TfSB1/src/drawing_primitives.jl:225
  draw_atomic(::GLMakie.GLScreen, ::Scene, ::LineSegments) at ~/.julia/packages/GLMakie/TfSB1/src/drawing_primitives.jl:243

My minimal example is now

@recipe(MyPlot, a) do scene
    Theme(
        plot_color = :red
    )
end

function Makie.plot!(myplot::MyPlot, a)
    myplot
end

f = Figure()
myplot(f[1,1], 1)

I see many draw_atomic() in GLMakie/src/drawing_primitives.jl. I’m not sure why I get the error from my example, but not from the SockChart example. A hint would be very much appreciated.

Now let me go back to plot!() in src/interfaces.jl. What is the argument tuple in lift()? Does Julia have a special variable call tuple? just like ans? Or is it a global variable? Why the interpreter says:

MethodError: no method matching lift(::typeof(tuple))

? You said

lift being called only with a function argument (tuple)

But I don’t see tuple in plot!().

I see now that tuple is the function tuple(). And the lift() line is creating a tuple from input_nodes.

I think I fixed this on Makie master, or in one of my PRs

Hi @sdanisch,

This must be it?

Yes!

1 Like

Trying to test the commit above but I can’t run the following simple script on master REPL. (I’m pasting the error message at the end.)

Git bisect showed me that the commit 432b8ab0b is the first one to fail. But there are a few other commits on top of it in the master branch, so I’m assuming I’m doing something wrong.

using Makie
using GLMakie
lines(1:10, rand(10))

The error occurs with both 1.7.2 and 1.8.0-beta3

1.7.2

Error showing value of type Makie.FigureAxisPlot:
ERROR: Space screen not recognized. Must be one of (:data, :pixel, :relative, :clip)
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] space_to_clip
    @ ~/.julia/dev/Makie/src/camera/projection_math.jl:324 [inlined]
  [3] space_to_clip
    @ ~/.julia/dev/Makie/src/camera/projection_math.jl:315 [inlined]
  [4] (::GLMakie.var"#143#154"{Camera})(s::Symbol, ms::Symbol, pv::StaticArrays.SMatrix{4, 4, Float32, 16}, res::Vec{2, Float32})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:384
  [5] map(::GLMakie.var"#143#154"{Camera}, ::Observable{Symbol}, ::Observable{Symbol}, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:477
  [6] map(::GLMakie.var"#143#154"{Camera}, ::Observable{Symbol}, ::Observable{Symbol}, ::Observable{StaticArrays.SMatrix{4, 4, Float32, 16}}, ::Vararg{Any})
    @ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:466
  [7] (::GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}})(gl_attributes::Dict{Symbol, Any})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:383
  [8] (::GLMakie.var"#103#106"{GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, GLMakie.Screen, Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}})()
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:107
  [9] get!(default::GLMakie.var"#103#106"{GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, GLMakie.Screen, Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64)
    @ Base ./dict.jl:464
 [10] cached_robj!(robj_func::GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, screen::GLMakie.Screen, scene::Scene, x::MakieCore.Text{Tuple{Makie.GlyphCollection}})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:85
 [11] draw_atomic
    @ ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:304 [inlined]
 [12] insert!
    @ ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:121 [inlined]
 [13] (::GLMakie.var"#109#110"{GLMakie.Screen, Scene})(x::MakieCore.Text{Tuple{Makie.GlyphCollection}})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:126
 [14] foreach(f::GLMakie.var"#109#110"{GLMakie.Screen, Scene}, itr::Vector{AbstractPlot})
    @ Base ./abstractarray.jl:2694
 [15] insert!(screen::GLMakie.Screen, scene::Scene, x::Combined)
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:123
 [16] insertplots!(screen::GLMakie.Screen, scene::Scene)
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:56
 [17] backend_display(screen::GLMakie.Screen, scene::Scene)
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/display.jl:18
 [18] backend_display
    @ ~/.julia/dev/Makie/GLMakie/src/display.jl:4 [inlined]
 [19] display(scene::Scene)
    @ Makie ~/.julia/dev/Makie/src/display.jl:59
 [20] #display#910
    @ ~/.julia/dev/Makie/src/display.jl:53 [inlined]
 [21] display
    @ ~/.julia/dev/Makie/src/display.jl:53 [inlined]
 [22] #display#909
    @ ~/.julia/dev/Makie/src/display.jl:52 [inlined]
 [23] display(fap::Makie.FigureAxisPlot)
    @ Makie ~/.julia/dev/Makie/src/display.jl:52
 [24] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [25] invokelatest
    @ ./essentials.jl:714 [inlined]
 [26] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:293
 [27] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:277
 [28] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:510
 [29] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:275
 [30] (::REPL.var"#do_respond#66"{Bool, Bool, REPL.var"#77#87"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
 [31] (::REPL.var"#82#92"{Regex, Int64, Int64, Int64, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt})(::REPL.LineEdit.MIState, ::Any, ::Vararg{Any})
    @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:1174
 [32] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [33] invokelatest
    @ ./essentials.jl:714 [inlined]
 [34] (::REPL.LineEdit.var"#25#26"{REPL.var"#82#92"{Regex, Int64, Int64, Int64, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt, REPL.LineEdit.Prompt}, String})(s::Any, p::Any)
    @ REPL.LineEdit ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:1466
 [35] prompt!(term::REPL.Terminals.TextTerminal, prompt::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:2586
 [36] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:2488
 [37] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:1232
 [38] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:423

1.8.0-beta3

Error showing value of type Makie.FigureAxisPlot:
ERROR: Space screen not recognized. Must be one of (:data, :pixel, :relative, :clip)
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] space_to_clip
    @ ~/.julia/dev/Makie/src/camera/projection_math.jl:324 [inlined]
  [3] space_to_clip
    @ ~/.julia/dev/Makie/src/camera/projection_math.jl:315 [inlined]
  [4] (::GLMakie.var"#143#154"{Camera})(s::Symbol, ms::Symbol, pv::StaticArrays.SMatrix{4, 4, Float32, 16}, res::Vec{2, Float32})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:384
  [5] map(::GLMakie.var"#143#154"{Camera}, ::Observable{Symbol}, ::Observable{Symbol}, ::Vararg{Any}; kwargs::Base.Pairs{Symbol, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:477
  [6] map(::GLMakie.var"#143#154"{Camera}, ::Observable{Symbol}, ::Observable{Symbol}, ::Observable{StaticArrays.SMatrix{4, 4, Float32, 16}}, ::Vararg{Any})
    @ Observables ~/.julia/packages/Observables/OFj0u/src/Observables.jl:466
  [7] (::GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}})(gl_attributes::Dict{Symbol, Any})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:383
  [8] (::GLMakie.var"#103#106"{GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, GLMakie.Screen, Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}})()
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:107
  [9] get!(default::GLMakie.var"#103#106"{GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, GLMakie.Screen, Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, h::Dict{UInt64, GLMakie.GLAbstraction.RenderObject}, key::UInt64)
    @ Base ./dict.jl:481
 [10] cached_robj!(robj_func::GLMakie.var"#133#144"{Scene, MakieCore.Text{Tuple{Makie.GlyphCollection}}}, screen::GLMakie.Screen, scene::Scene, x::MakieCore.Text{Tuple{Makie.GlyphCollection}})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:85
 [11] draw_atomic
    @ ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:304 [inlined]
 [12] insert!
    @ ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:121 [inlined]
 [13] (::GLMakie.var"#109#110"{GLMakie.Screen, Scene})(x::MakieCore.Text{Tuple{Makie.GlyphCollection}})
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:126
 [14] foreach(f::GLMakie.var"#109#110"{GLMakie.Screen, Scene}, itr::Vector{AbstractPlot})
    @ Base ./abstractarray.jl:2769
 [15] insert!(screen::GLMakie.Screen, scene::Scene, x::Combined)
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/drawing_primitives.jl:123
 [16] insertplots!(screen::GLMakie.Screen, scene::Scene)
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/screen.jl:56
 [17] backend_display(screen::GLMakie.Screen, scene::Scene)
    @ GLMakie ~/.julia/dev/Makie/GLMakie/src/display.jl:18
 [18] backend_display
    @ ~/.julia/dev/Makie/GLMakie/src/display.jl:4 [inlined]
 [19] display(scene::Scene)
    @ Makie ~/.julia/dev/Makie/src/display.jl:59
 [20] #display#910
    @ ~/.julia/dev/Makie/src/display.jl:53 [inlined]
 [21] display
    @ ~/.julia/dev/Makie/src/display.jl:53 [inlined]
 [22] #display#909
    @ ~/.julia/dev/Makie/src/display.jl:52 [inlined]
 [23] display(fap::Makie.FigureAxisPlot)
    @ Makie ~/.julia/dev/Makie/src/display.jl:52
 [24] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [25] invokelatest
    @ ./essentials.jl:727 [inlined]
 [26] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:296
 [27] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:278
 [28] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:521
 [29] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:276
 [30] (::REPL.var"#do_respond#66"{Bool, Bool, REPL.var"#77#87"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:857
 [31] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [32] invokelatest
    @ ./essentials.jl:727 [inlined]
 [33] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:2509
 [34] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/julia-1.8.0-beta3/share/julia/stdlib/v1.8/REPL/src/REPL.jl:1248
 [35] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:482

You need to add MakieCore from that commit as well

1 Like