Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recipe with Lines and Circle not working #3812

Closed
3 tasks done
dlfivefifty opened this issue Apr 27, 2024 · 4 comments
Closed
3 tasks done

Recipe with Lines and Circle not working #3812

dlfivefifty opened this issue Apr 27, 2024 · 4 comments
Labels

Comments

@dlfivefifty
Copy link
Contributor

  • are you running newest version (version from docs) ?
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie)
  • What platform + GPU are you on? New MacBook Air

I made a simple recipe involving conversion to a circle but it throws an error because it is trying to iterate over a Circle:

julia> using CairoMakie, Makie

julia> struct MyCircle end

julia> Base.convert(::Type{Circle}, ::MyCircle) = Circle(Point(0.0,0.0), 1.0)

julia> Makie.convert_arguments(::Type{<:Lines}, c::MyCircle) = (convert(Circle, c),)

julia> lines(convert(Circle, MyCircle())); # works

julia> lines(MyCircle())
Error showing value of type Makie.FigureAxisPlot:
ERROR: MethodError: no method matching iterate(::Circle{Float64})

Closest candidates are:
  iterate(::ExponentialBackOff)
   @ Base error.jl:260
  iterate(::ExponentialBackOff, ::Any)
   @ Base error.jl:260
  iterate(::ChainRulesCore.NotImplemented)
   @ ChainRulesCore ~/.julia/packages/ChainRulesCore/zgT0R/src/tangent_types/notimplemented.jl:62
  ...

Stacktrace:
  [1] isempty(itr::Circle{Float64})
    @ Base ./essentials.jl:957
  [2] isempty(g::Base.Generator{Circle{Float64}, Makie.var"#929#930"{StaticArraysCore.SMatrix{…}, Symbol, typeof(identity)}})
    @ Base ./generator.jl:56
  [3] limits_from_transformed_points(points_iterator::Base.Generator{Circle{…}, Makie.var"#929#930"{…}})
    @ Makie ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:199
  [4] data_limits(plot::Lines{Tuple{Circle{Float64}}})
    @ Makie ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:173
  [5] (::Makie.var"#936#938"{Makie.var"#exclude#1639"{}, Base.RefValue{}})(plot::Lines{Tuple{…}})
    @ Makie ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:225
  [6] foreach(f::Makie.var"#936#938"{Makie.var"#exclude#1639"{}, Base.RefValue{}}, itr::Vector{AbstractPlot})
    @ Base ./abstractarray.jl:3097
  [7] foreach_plot
    @ ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:108 [inlined]
  [8] foreach_plot
    @ ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:102 [inlined]
  [9] data_limits
    @ ~/.julia/packages/Makie/ND0gA/src/layouting/data_limits.jl:223 [inlined]
 [10] getlimits(la::Axis, dim::Int64)
    @ Makie ~/.julia/packages/Makie/ND0gA/src/makielayout/blocks/axis.jl:843
 [11] autolimits(ax::Axis, dim::Int64)
    @ Makie ~/.julia/packages/Makie/ND0gA/src/makielayout/blocks/axis.jl:920
 [12] xautolimits
    @ ~/.julia/packages/Makie/ND0gA/src/makielayout/blocks/axis.jl:951 [inlined]
 [13] reset_limits!(ax::Axis; xauto::Bool, yauto::Bool, zauto::Bool)
    @ Makie ~/.julia/packages/Makie/ND0gA/src/makielayout/blocks/axis.jl:572
 [14] reset_limits!
    @ ~/.julia/packages/Makie/ND0gA/src/makielayout/blocks/axis.jl:559 [inlined]
 [15] update_state_before_display!(ax::Axis)
    @ Makie ~/.julia/packages/Makie/ND0gA/src/figureplotting.jl:309
 [16] update_state_before_display!(f::Figure)
    @ Makie ~/.julia/packages/Makie/ND0gA/src/figureplotting.jl:217
 [17] update_state_before_display!
    @ ~/.julia/packages/Makie/ND0gA/src/figureplotting.jl:213 [inlined]
 [18] display(figlike::Makie.FigureAxisPlot; backend::Module, inline::MakieCore.Automatic, update::Bool, screen_config::@Kwargs{})
    @ Makie ~/.julia/packages/Makie/ND0gA/src/display.jl:164
 [19] display(figlike::Makie.FigureAxisPlot)
    @ Makie ~/.julia/packages/Makie/ND0gA/src/display.jl:130
 [20] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{…})
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:0
 [21] (::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:284
 [22] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:569
 [23] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:282
 [24] (::REPL.var"#do_respond#80"{})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:911
 [25] #invokelatest#2
    @ ./essentials.jl:892 [inlined]
 [26] invokelatest
    @ ./essentials.jl:889 [inlined]
 [27] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/LineEdit.jl:2656
 [28] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:1312
 [29] (::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ~/Projects/julia-1.10/usr/share/julia/stdlib/v1.10/REPL/src/REPL.jl:386
Some type information was truncated. Use `show(err)` to see complete types.
@asinghvi17
Copy link
Member

try:

julia> Makie.convert_arguments(::Type{<:Lines}, c::MyCircle) = Makie.convert_arguments(Lines, convert(Circle, c))

@dlfivefifty
Copy link
Contributor Author

Thanks!

@asinghvi17
Copy link
Member

This could probably use some more emphatic documentation that convert_arguments is not recursive

@dlfivefifty
Copy link
Contributor Author

Yes the recipe documentation is extremely lacking...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants