Skip to content

failed to plot a simple scatter coloured plot #645

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

Closed
lazarusA opened this issue Apr 10, 2025 · 3 comments · Fixed by #646
Closed

failed to plot a simple scatter coloured plot #645

lazarusA opened this issue Apr 10, 2025 · 3 comments · Fixed by #646

Comments

@lazarusA
Copy link
Collaborator

lazarusA commented Apr 10, 2025

what is the appropriate syntax to get a scatter plot with a colormap, each point should be coloured according to their value.

using AlgebraOfGraphics, GLMakie
df = (x=rand(100), y=rand(100), z=rand(100))
xyz = data(df) * mapping(:x, :y; color=:z) * visual(Scatter)
draw(xyz)

this the current error for that input

ERROR: MethodError: no method matching numbers_to_colors(::Vector{…}, ::Vector{…}, ::typeof(identity), ::Vec{…}, ::ColorTypes.RGBA{…}, ::ColorTypes.RGBA{…}, ::ColorTypes.RGBA{…})
The function `numbers_to_colors` exists, but no method is defined for this combination of argument types.

Closest candidates are:
  numbers_to_colors(::Union{Number, AbstractArray{<:Number, N}}, ::Any, ::Any, ::Vec2, ::Union{MakieCore.Automatic, ColorTypes.RGBA{Float32}}, ::Union{MakieCore.Automatic, ColorTypes.RGBA{Float32}}, ::ColorTypes.RGBA{Float32}, ::Any) where N
   @ Makie ~/.julia/packages/Makie/j3niK/src/colorsampler.jl:168
  numbers_to_colors(::Union{Number, AbstractArray{<:Number}}, ::Any)
   @ Makie ~/.julia/packages/Makie/j3niK/src/colorsampler.jl:149

Stacktrace:
  [1] full_rescale(data::Vector{…}, aes::Type{…}, scale::AlgebraOfGraphics.ContinuousScale{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:547
  [2] full_rescale(data::Vector{…}, key::Symbol, aes_mapping::Dictionaries.Dictionary{…}, scale_mapping::Dictionaries.Dictionary{…}, categoricalscales::Dictionaries.Dictionary{…}, continuousscales::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:506
  [3] (::AlgebraOfGraphics.var"#157#162"{…})(::Pair{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:448
  [4] map!(f::AlgebraOfGraphics.var"#157#162"{…}, out::Dictionaries.Dictionary{…}, d::Dictionaries.PairDictionary{…})
    @ Dictionaries ~/.julia/packages/Dictionaries/L8pH7/src/map.jl:66
  [5] map
    @ ~/.julia/packages/Dictionaries/L8pH7/src/map.jl:106 [inlined]
  [6] to_entry(P::Type, p::ProcessedLayer, categoricalscales::Dictionaries.Dictionary{…}, continuousscales::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:447
  [7] to_entry(p::ProcessedLayer, categoricalscales::Dictionaries.Dictionary{…}, continuousscales::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:430
  [8] #142
    @ ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:172 [inlined]
  [9] iterate
    @ ./generator.jl:48 [inlined]
 [10] _collect(c::Vector{…}, itr::Base.Generator{…}, ::Base.EltypeUnknown, isz::Base.HasShape{…})
    @ Base ./array.jl:811
 [11] collect_similar
    @ ./array.jl:720 [inlined]
 [12] map
    @ ./abstractarray.jl:3371 [inlined]
 [13] #141
    @ ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:171 [inlined]
 [14] #4
    @ ./generator.jl:37 [inlined]
 [15] iterate
    @ ./generator.jl:48 [inlined]
 [16] collect(itr::Base.Generator{Base.Iterators.Zip{Tuple{…}}, Base.var"#4#5"{AlgebraOfGraphics.var"#141#145"{…}}})
    @ Base ./array.jl:791
 [17] map
    @ ./abstractarray.jl:3495 [inlined]
 [18] compute_entries_continuousscales(pls_grid::Matrix{…}, categoricalscales::Dictionaries.Dictionary{…}, scale_props::Dictionaries.Dictionary{…})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:170
 [19] compute_axes_grid(d::Layer, scales::AlgebraOfGraphics.Scales; axis::Dictionaries.Dictionary{Symbol, Any})
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:327
 [20] compute_axes_grid
    @ ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/algebra/layers.jl:293 [inlined]
 [21] _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/AVqyq/src/draw.jl:169
 [22] _draw
    @ ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/draw.jl:166 [inlined]
 [23] draw(d::Layer, scales::AlgebraOfGraphics.Scales; axis::@NamedTuple{}, figure::@NamedTuple{}, facet::@NamedTuple{}, legend::@NamedTuple{}, colorbar::@NamedTuple{}, palette::Nothing)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/draw.jl:97
 [24] draw
    @ ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/draw.jl:87 [inlined]
 [25] draw(d::Layer)
    @ AlgebraOfGraphics ~/.julia/packages/AlgebraOfGraphics/AVqyq/src/draw.jl:87
 [26] top-level scope
    @ REPL[88]:1
Some type information was truncated. Use `show(err)` to see complete types.

this is related to #627, where the initial MWE now is also not working, and the code from above reproduces the same issue.

@jkrumbiegel
Copy link
Member

Hm maybe I broke something, although it seems a basic case like this should be covered by a reftest..

@lazarusA
Copy link
Collaborator Author

lazarusA commented Apr 11, 2025

Oh, yes, that's the reason also the latest build on AoG master is failing (maybe Makie is the one breaking things up, the corresponding PR was passing CI before merging).
https://github.com/MakieOrg/AlgebraOfGraphics.jl/actions/runs/14341759805/job/40273705554#step:7:19

@jkrumbiegel
Copy link
Member

jkrumbiegel commented Apr 11, 2025

ok yeah that could be, that function is internal after all.. I'll have a look

Edit: There's another argument, interpolate that was added recently

MakieOrg/Makie.jl@42ce5ea

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

Successfully merging a pull request may close this issue.

2 participants