Skip to content
This repository was archived by the owner on Jul 15, 2021. It is now read-only.
This repository was archived by the owner on Jul 15, 2021. It is now read-only.

updating to work with latest AbstractPlotting.jl #28

@goretkin

Description

@goretkin

from examples.jl:

using MakieRecipes.RecipesBase

struct T end

RecipesBase.@recipe function plot(::T, n = 1; customcolor = :green)
    markershape --> :auto        # if markershape is unset, make it :auto
    markercolor :=  customcolor  # force markercolor to be customcolor
    xrotation   --> 45           # if xrotation is unset, make it 45
    zrotation   --> 90           # if zrotation is unset, make it 90
    rand(10,n)                   # return the arguments (input data) for the next recipe
end

sc = Scene()
recipeplot!(sc, T(); seriestype = :path);

gives

ERROR: MethodError: no constructors have been defined for Any
Stacktrace:
  [1] plot!(::Combined{MakieRecipes.recipeplot, Tuple{T}}, ::Type{Any}, ::Attributes, ::Type, ::Base.OneTo{Int64}, ::Vector{Float64})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:797
  [2] plot!(::Type{Any}, ::Combined{MakieRecipes.recipeplot, Tuple{T}}, ::Type, ::Vararg{Any, N} where N; kw_attributes::Base.Iterators.Pairs{Symbol, Any, NTuple{14, Symbol}, NamedTuple{(:transparency, :ssao, :lightposition, :transformation, :model, :diffuse, :specular, :visible, :ambient, :nan_color, :shininess, :overdraw, :color, :linewidth), Tuple{Bool, Bool, Symbol, AbstractPlotting.Automatic, StaticArrays.SMatrix{4, 4, Float32, 16}, Vec{3, Float32}, Vec{3, Float32}, Bool, Vec{3, Float32}, ColorTypes.RGBA{Float32}, Float32, Bool, ColorTypes.RGBA{Float32}, Int64}}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:627
  [3] plot!(::Combined{MakieRecipes.recipeplot, Tuple{T}}, ::Vararg{Any, N} where N; attributes::Base.Iterators.Pairs{Symbol, Any, NTuple{14, Symbol}, NamedTuple{(:transparency, :ssao, :lightposition, :transformation, :model, :diffuse, :specular, :visible, :ambient, :nan_color, :shininess, :overdraw, :color, :linewidth), Tuple{Bool, Bool, Symbol, AbstractPlotting.Automatic, StaticArrays.SMatrix{4, 4, Float32, 16}, Vec{3, Float32}, Vec{3, Float32}, Bool, Vec{3, Float32}, ColorTypes.RGBA{Float32}, Float32, Bool, ColorTypes.RGBA{Float32}, Int64}}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/recipes.jl:16
  [4] add_series!(plt::Combined{MakieRecipes.recipeplot, Tuple{T}}, plotattributes::DefaultsDict)
    @ MakieRecipes ~/repos/MakieRecipes.jl/src/pipeline_integration.jl:380
  [5] _process_seriesrecipe(plt::Any, plotattributes::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/CirY4/src/series_recipe.jl:46
  [6] _process_seriesrecipes!(plt::Any, kw_list::Any)
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/CirY4/src/series_recipe.jl:27
  [7] recipe_pipeline!
    @ ~/.julia/packages/RecipesPipeline/CirY4/src/RecipesPipeline.jl:97 [inlined]
  [8] (::MakieRecipes.var"#20#21"{Combined{MakieRecipes.recipeplot, Tuple{T}}})(::Int64, ::Attributes, ::Tuple{Observable{T}}, ::T, ::Vararg{Any, N} where N)
    @ MakieRecipes ~/repos/MakieRecipes.jl/src/recipeplot.jl:24
  [9] lift(::Function, ::Observable{Int64}, ::Attributes, ::Vararg{Any, N} where N)
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interaction/nodes.jl:15
 [10] plot!
    @ ~/repos/MakieRecipes.jl/src/recipeplot.jl:20 [inlined]
 [11] plot!(scene::Scene, P::Type{Combined{MakieRecipes.recipeplot, Tuple{T}}}, attributes::Attributes, input::Tuple{Observable{T}}, args::Observable{Tuple{T}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:772
 [12] plot!(scene::Scene, P::Type{Combined{MakieRecipes.recipeplot, ArgType} where ArgType}, attributes::Attributes, args::T; kw_attributes::Base.Iterators.Pairs{Union{}, Union{}, Tuple{}, NamedTuple{(), Tuple{}}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:683
 [13] plot!(scene::Scene, P::Type{Combined{MakieRecipes.recipeplot, ArgType} where ArgType}, attributes::Attributes, args::T)
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:652
 [14] plot!(P::Type{Combined{MakieRecipes.recipeplot, ArgType} where ArgType}, scene::Scene, args::T; kw_attributes::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:seriestype,), Tuple{Symbol}}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:627
 [15] recipeplot!(::Scene, ::Vararg{Any, N} where N; attributes::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:seriestype,), Tuple{Symbol}}})
    @ MakieRecipes ~/.julia/packages/AbstractPlotting/mG7hv/src/recipes.jl:16
 [16] top-level scope
    @ REPL[25]:1

when using the latest AbstractPlotting.jl (not surprising, a lot has changed in a year). I tried to follow along with some differences such as

AbstractPlotting has space key:
JuliaPlots/CairoMakie.jl@0c9db4e

PlotUtils.cgradients is no longer:
https://github.com/JuliaPlots/PlotUtils.jl/pull/87/files

default_plot_signatures and the "Any" plot type:
JuliaPlots/AbstractPlotting.jl#459

but there are too many pieces that I am unfamiliar with.

From what I can tell, one problem is that https://github.com/JuliaPlots/AbstractPlotting.jl/blob/fb515a42f66e592bdbf1e1201286d267ae601756/src/interfaces.jl#L796

is invoked twice:

 [14] plot!(P::Type{Combined{MakieRecipes.recipeplot, ArgType} where ArgType}, scene::Scene, args::T; kw_attributes::Base.Iterators.Pairs{Symbol, Symbol, Tuple{Symbol}, NamedTuple{(:seriestype,), Tuple{Symbol}}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:627
  [2] plot!(::Type{Any}, ::Combined{MakieRecipes.recipeplot, Tuple{T}}, ::Type, ::Vararg{Any, N} where N; kw_attributes::Base.Iterators.Pairs{Symbol, Any, NTuple{14, Symbol}, NamedTuple{(:transparency, :ssao, :lightposition, :transformation, :model, :diffuse, :specular, :visible, :ambient, :nan_color, :shininess, :overdraw, :color, :linewidth), Tuple{Bool, Bool, Symbol, AbstractPlotting.Automatic, StaticArrays.SMatrix{4, 4, Float32, 16}, Vec{3, Float32}, Vec{3, Float32}, Bool, Vec{3, Float32}, ColorTypes.RGBA{Float32}, Float32, Bool, ColorTypes.RGBA{Float32}, Int64}}})
    @ AbstractPlotting ~/.julia/packages/AbstractPlotting/mG7hv/src/interfaces.jl:627

This does not appear to happen when using the compatible version of AbstractPlotting (from ~1 year ago).

If anyone can spare advice, I'd be willing to play around a bit more with this. There are over 200 packages that depend on RecipesBase.jl, and it would be nice to leverage that in the Makie ecosystem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions