Skip to content
This repository has been archived by the owner on Oct 21, 2022. It is now read-only.

Recipe macro too aggressively looks for d #39

Closed
ChrisRackauckas opened this issue Feb 5, 2018 · 1 comment
Closed

Recipe macro too aggressively looks for d #39

ChrisRackauckas opened this issue Feb 5, 2018 · 1 comment

Comments

@ChrisRackauckas
Copy link
Member

In this code:

@recipe function f(bif::BifurcationCurve,coords)
  x = bif.d[coords[1]]
  y = bif.d[coords[2]]
  g = bif.stab
  style_order = unique(bif.stab)
  linestyle --> reshape([style == "S" ? :solid : :dash for style in style_order],1,length(style_order))
  color --> reshape([style == "S" ? :blue : :red for style in style_order],1,length(style_order))
  legend --> false
  xlabel --> coords[1]
  ylabel --> coords[2]
  for k in keys(bif.special_points)
    @series begin
      seriestype --> :scatter
      markersize --> 5
      color := :red
      [bif.special_points[k][coords[1]]],[bif.special_points[k][coords[2]]]
    end
  end
  CompositeLine((x, y, g))
end

I get the error

type BifurcationCurve has no field plotattributes
macro expansion at bifurcation.jl:10 [inlined]
apply_recipe(::Dict{Symbol,Any}, ::PyDSTool.BifurcationCurve{DataStructures.OrderedDict{Symbol,Array{Float64,1}},Dict{String,Any}}, ::Tuple{Symbol,Symbol}) at RecipesBase.jl:287
_process_userrecipes(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{PyDSTool.BifurcationCurve{DataStructures.OrderedDict{Symbol,Array{Float64,1}},Dict{String,Any}},Tuple{Symbol,Symbol}}) at pipeline.jl:81
_plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{PyDSTool.BifurcationCurve{DataStructures.OrderedDict{Symbol,Array{Float64,1}},Dict{String,Any}},Tuple{Symbol,Symbol}}) at plot.jl:177
#plot#176(::Array{Any,1}, ::Function, ::PyDSTool.BifurcationCurve{DataStructures.OrderedDict{Symbol,Array{Float64,1}},Dict{String,Any}}, ::Vararg{Any,N} where N) at plot.jl:58
plot(::PyDSTool.BifurcationCurve{DataStructures.OrderedDict{Symbol,Array{Float64,1}},Dict{String,Any}}, ::Tuple{Symbol,Symbol}, ::Vararg{Tuple{Symbol,Symbol},N} where N) at plot.jl:52
include_string(::String, ::String, ::Int64) at eval.jl:30
include_string(::Module, ::String, ::String, ::Int64, ::Vararg{Int64,N} where N) at eval.jl:34
(::Atom.##100#105{String,Int64,String})() at eval.jl:75
withpath(::Atom.##100#105{String,Int64,String}, ::String) at utils.jl:30
withpath(::Function, ::String) at eval.jl:38
hideprompt(::Atom.##99#104{String,Int64,String}) at repl.jl:63
macro expansion at eval.jl:73 [inlined]
(::Atom.##98#103{Dict{String,Any}})() at task.jl:80

I realized this is just because the macro is replacing the d references. I wonder if this happens because of #20 because it used to not happen. Anyways, it has an easy workaround so I'm not worried.

@daschw
Copy link
Member

daschw commented Mar 25, 2020

I think that is already fixed by #47. Otherwise feel free to reopen.

@daschw daschw closed this as completed Mar 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants