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

Error processing example in README (Makie upgrade) #90

Closed
PhyX-Meow opened this issue Nov 7, 2021 · 5 comments
Closed

Error processing example in README (Makie upgrade) #90

PhyX-Meow opened this issue Nov 7, 2021 · 5 comments

Comments

@PhyX-Meow
Copy link

Hello, I'm trying to run this example in README.md

using Grassmann, Makie; @basis S"∞+++"
f(t) = ↓(exp(t*(v12+0.07v∞*(sin(3t)*3v1+cos(2t)*7v2-sin(5t)*4v3)/2))>>>↑(v1+v2-v3))
lines(V(2,3,4).(points(f)))

But got the following error:

julia> using Grassmann, GLMakie

julia> @basis S"∞+++"
(⟨∞+++⟩, v, v∞, v₁, v₂, v₃, v∞₁, v∞₂, v∞₃, v₁₂, v₁₃, v₂₃, v∞₁₂, v∞₁₃, v∞₂₃, v₁₂₃, v∞₁₂₃)

julia> f(t) = ↓(exp(t*(v12+0.07v∞*(sin(3t)*3v1+cos(2t)*7v2-sin(5t)*4v3)/2))>>>↑(v1+v2-v3))
f (generic function with 1 method)

julia> lines(V(2,3,4).(points(f)))
ERROR: `Makie.convert_arguments` for the plot type Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}} and its conversion trait PointBased() was unsuccessful.

The signature that could not be converted was:
::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}

Makie needs to convert all plot input arguments to types that can be consumed by the backends (typically Arrays with Float32 elements).
You can define a method for `Makie.convert_arguments` (a type recipe) for these types or their supertypes to make this set of arguments convertible (See http://makie.juliaplots.org/stable/documentation/recipes/index.html).

Alternatively, you can define `Makie.convert_single_argument` for single arguments which have types that are unknown to Makie but which can be converted to known types and fed back to the conversion pipeline.

Stacktrace:
 [1] convert_arguments(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:17
 [2] convert_arguments(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:8
 [3] plot!(scene::Scene, P::Type{Lines{ArgType} where ArgType}, attributes::Attributes, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; kw_attributes::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:show_axis,), Tuple{Bool}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/interfaces.jl:321
 [4] plot(P::Type{Lines{ArgType} where ArgType}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; axis::NamedTuple{(), Tuple{}}, figure::NamedTuple{(), Tuple{}}, kw_attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:28
 [5] plot(P::Type{Lines{ArgType} where ArgType}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:18
 [6] lines(args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ MakieCore ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
 [7] lines(args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ MakieCore ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
 [8] top-level scope
   @ REPL[12]:1

caused by: MethodError: no method matching convert_arguments(::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, ::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
Closest candidates are:
  convert_arguments(::Union{Type{Any}, Type{var"#s268"} where var"#s268"<:AbstractPlot}, ::Union{AbstractVector{T} where T, IntervalSets.Interval}, ::Distributions.Distribution) at /home/wuli/.julia/packages/Makie/gQOQF/src/stats/distributions.jl:21
  convert_arguments(::Union{Type{Any}, Type{var"#s268"} where var"#s268"<:AbstractPlot}, ::AbstractVector{T} where T, ::Function) at /home/wuli/.julia/packages/Makie/gQOQF/src/conversions.jl:546
  convert_arguments(::Union{Type{Any}, Type{var"#s268"} where var"#s268"<:AbstractPlot}, ::Any...; kw...) at /home/wuli/.julia/packages/Makie/gQOQF/src/conversions.jl:7
  ...
Stacktrace:
 [1] convert_arguments_individually(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:47
 [2] convert_arguments(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:14
 [3] convert_arguments(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:8
 [4] plot!(scene::Scene, P::Type{Lines{ArgType} where ArgType}, attributes::Attributes, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; kw_attributes::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:show_axis,), Tuple{Bool}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/interfaces.jl:321
 [5] plot(P::Type{Lines{ArgType} where ArgType}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; axis::NamedTuple{(), Tuple{}}, figure::NamedTuple{(), Tuple{}}, kw_attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:28
 [6] plot(P::Type{Lines{ArgType} where ArgType}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:18
 [7] lines(args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ MakieCore ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
 [8] lines(args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ MakieCore ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
 [9] top-level scope
   @ REPL[12]:1

caused by: MethodError: no method matching convert_arguments(::PointBased, ::UnitRange{Int64}, ::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
Closest candidates are:
  convert_arguments(::PointBased, ::AbstractVector{T} where T<:Number, ::AbstractVector{T} where T<:Number, ::AbstractVector{T} where T<:Number) at /home/wuli/.julia/packages/Makie/gQOQF/src/conversions.jl:114
  convert_arguments(::PointBased, ::AbstractVector{T} where T, ::AbstractVector{T} where T, ::AbstractMatrix{T} where T) at /home/wuli/.julia/packages/Makie/gQOQF/src/conversions.jl:104
  convert_arguments(::SurfaceLike, ::AbstractVector{T1}, ::AbstractVector{T2}, ::Function) where {T1, T2} at /home/wuli/.julia/packages/Makie/gQOQF/src/conversions.jl:348
  ...
Stacktrace:
 [1] convert_arguments(P::PointBased, y::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:139
 [2] convert_arguments(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; kw::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:10
 [3] convert_arguments(T::Type{Lines{Tuple{Vector{Chain{⟨_+++⟩, 1, Float64, 3}}}}}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/conversions.jl:8
 [4] plot!(scene::Scene, P::Type{Lines{ArgType} where ArgType}, attributes::Attributes, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; kw_attributes::Base.Iterators.Pairs{Symbol, Bool, Tuple{Symbol}, NamedTuple{(:show_axis,), Tuple{Bool}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/interfaces.jl:321
 [5] plot(P::Type{Lines{ArgType} where ArgType}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; axis::NamedTuple{(), Tuple{}}, figure::NamedTuple{(), Tuple{}}, kw_attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:28
 [6] plot(P::Type{Lines{ArgType} where ArgType}, args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ Makie ~/.julia/packages/Makie/gQOQF/src/figureplotting.jl:18
 [7] lines(args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}}; attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
   @ MakieCore ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
 [8] lines(args::Vector{Chain{⟨_+++⟩, 1, Float64, 3}})
   @ MakieCore ~/.julia/packages/MakieCore/S8PkO/src/recipes.jl:31
 [9] top-level scope
   @ REPL[12]:1

Thanks for your amazing package and beautiful examples!

Operating System: ArchLinux
Julia version: 1.6.3
Grassmann version: v0.7.6
Makie version: GLMakie v0.4.7, Makie v0.15.3

@PhyX-Meow
Copy link
Author

I notice that GeometryTypes.jl has been replaced by GeometryBasics.jl, and what I installed is the later one, so may be this cause the problem?

@chakravala
Copy link
Owner

chakravala commented Nov 7, 2021

It seems that AbstractPlotting.lines is no longer the same function as Makie.lines, unlike previously. Therefore, error.

You can fix this problem temporarily by pinning a previous version of these auxiliary packages.

@chakravala
Copy link
Owner

chakravala commented Nov 7, 2021

One possible work around is to run this command by explicitly converting to Point instead:

lines(Point.(V(2,3,4).(points(f))))

@PhyX-Meow
Copy link
Author

One possible work around is to run this command by explicitly converting to Point instead:

lines(Point.(V(2,3,4).(points(f))))

Thank you! That works pretty well.

@chakravala chakravala changed the title Error processing example in README Error processing example in README (Makie upgrade) Nov 11, 2021
@chakravala
Copy link
Owner

The issue has now been fixed in v0.7.7, AbstractPlotting is deprecated and replaced with plain Makie.

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

No branches or pull requests

2 participants