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

Bad error message when forgetting to set data #575

Open
jkrumbiegel opened this issue Nov 1, 2024 · 0 comments
Open

Bad error message when forgetting to set data #575

jkrumbiegel opened this issue Nov 1, 2024 · 0 comments

Comments

@jkrumbiegel
Copy link
Member

This happens easily when building more complex expressions and forgetting parentheses, like data * layer1 + layer2 instead of data * (layer1 + layer2).

julia> mapping(:x, :y) * visual(Scatter) |> draw
ERROR: MethodError: no method matching length(::Symbol)

Closest candidates are:
  length(::DataStructures.EnumerateAll)
   @ DataStructures ~/.julia/packages/DataStructures/95DJa/src/multi_dict.jl:96
  length(::DelaunayTriangulation.BoundingInterval)
   @ DelaunayTriangulation ~/.julia/packages/DelaunayTriangulation/74rOt/src/data_structures/trees/rtree.jl:62
  length(::TranscodingStreams.Buffer)
   @ TranscodingStreams ~/.julia/packages/TranscodingStreams/O3BYF/src/buffer.jl:43
  ...

Stacktrace:
  [1] length(g::Base.Generator{Symbol, typeof(identity)})
    @ Base ./generator.jl:50
  [2] _similar_shape(itr::Base.Generator{Symbol, typeof(identity)}, ::Base.HasLength)
    @ Base ./array.jl:710
  [3] collect(itr::Base.Generator{Symbol, typeof(identity)})
    @ Base ./array.jl:833
  [4] map(f::Function, A::Symbol)
    @ Base ./abstractarray.jl:3313
  [5] (::AlgebraOfGraphics.var"#190#195")(x::Tuple{Symbol})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/processing.jl:85
  [6] iterate
    @ ./generator.jl:47 [inlined]
  [7] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{Vector{Symbol}}}, AlgebraOfGraphics.var"#190#195"})
    @ Base ./array.jl:834
  [8] map(f::Function, A::Base.Iterators.Zip{Tuple{Vector{Symbol}}})
    @ Base ./abstractarray.jl:3313
  [9] getlabeledarray(layer::Layer, s::Symbol)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/processing.jl:85
 [10] (::AlgebraOfGraphics.var"#204#210"{Layer})(v::Symbol)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/processing.jl:128
 [11] iterate
    @ ./generator.jl:47 [inlined]
 [12] _collect(c::Vector{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base ./array.jl:854
 [13] collect_similar
    @ ./array.jl:763 [inlined]
 [14] map
    @ ./abstractarray.jl:3285 [inlined]
 [15] process_mappings(layer::Layer)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/processing.jl:128
 [16] process(layer::Layer)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/processing.jl:162
 [17] ProcessedLayers
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/layers.jl:55 [inlined]
 [18] compute_axes_grid(d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/layers.jl:250
 [19] compute_axes_grid
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/layers.jl:248 [inlined]
 [20] compute_axes_grid(fig::Figure, d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/layers.jl:218
 [21] compute_axes_grid
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/algebra/layers.jl:215 [inlined]
 [22] #363
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:20 [inlined]
 [23] update
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:10 [inlined]
 [24] plot!(fig::Figure, d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:20
 [25] plot!
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:16 [inlined]
 [26] (::AlgebraOfGraphics.var"#374#379"{})(f::Figure)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:162
 [27] update
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:10 [inlined]
 [28] _draw(d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{…}, figure::Dictionaries.Dictionary{…}, facet::Dictionaries.Dictionary{…}, legend::Dictionaries.Dictionary{…}, colorbar::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:161
 [29] _draw
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:154 [inlined]
 [30] draw(d::Layer, scales::AlgebraOfGraphics.Scales; axis::@NamedTuple{}, figure::@NamedTuple{}, facet::@NamedTuple{}, legend::@NamedTuple{}, colorbar::@NamedTuple{}, palette::Nothing)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:85
 [31] draw
    @ ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:75 [inlined]
 [32] draw(d::Layer)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/OTZgv/src/draw.jl:75
 [33] |>(x::Layer, f::typeof(draw))
    @ Base ./operators.jl:917
 [34] top-level scope
    @ REPL[35]:1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant