-
-
Notifications
You must be signed in to change notification settings - Fork 306
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
barplot with Observable colors is broken #617
Comments
Looks like something weird is going on with GeometryBasics. Consider the following (stacktraces truncated): julia> cs = Observable(to_colormap(:viridis, 4))
julia> sc = barplot(rand(Point2f0, 4), color=cs)
julia> cs[] = to_colormap(:viridis, 4)
ERROR: Metadata array needs to have same length as data.
Found 16 data items, and 120 metadata items
Stacktrace:
Function Module Signature
──────── ────── ─────────
[1] error Base (::String)
at: /Applications/Julia-1.5.app/Contents/Resources/julia/bin/../share/julia/base/error.jl:33
[2] #meta#86 GeometryBasics (::Base.Iterators.Pairs{Symbol,Array{RGBA{Float32},1},Tuple{Symbol},NamedTuple{(:color,),Tuple{Array{RGBA{Float32},1}}}}, ::typeof(GeometryBasics.meta), ::Array{Point{2,Float32},1})
at: ~/.julia/packages/GeometryBasics/dwE6R/src/metadata.jl:111
[3] #pointmeta#160 GeometryBasics (::Base.Iterators.Pairs{Symbol,Array{RGBA{Float32},1},Tuple{Symbol},NamedTuple{(:color,),Tuple{Array{RGBA{Float32},1}}}}, ::typeof(GeometryBasics.pointmeta), ::GeometryBasics.Mesh{2,Float32,GeometryBas ...99+)
at: ~/.julia/packages/GeometryBasics/dwE6R/src/meshes.jl:245
[4] #123 GLMakie (::GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}}}}, ::Array{RGBA{Float32},1}, ::Nothing, ::Nothing)
at: ~/.julia/dev/GLMakie/src/drawing_primitives.jl:383
[5] MapUpdater Observables (::GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}}}}, ::Vararg{Any,N} where N)
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:241
[6] OnUpdate Observables (::Array{RGBA{Float32},1})
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:218
[7] #setindex!#5 Observables (::Observables.var"#6#8", ::typeof(setindex!), ::Observable{Array{RGBA{Float32},1}}, ::Array{RGBA{Float32},1})
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:130
julia> cs[] = to_colormap(:viridis, 4)
ERROR: Metadata array needs to have same length as data.
Found 16 data items, and 136 metadata items
Stacktrace:
Function Module Signature
──────── ────── ─────────
[1] error Base (::String)
at: /Applications/Julia-1.5.app/Contents/Resources/julia/bin/../share/julia/base/error.jl:33
[2] #meta#86 GeometryBasics (::Base.Iterators.Pairs{Symbol,Array{RGBA{Float32},1},Tuple{Symbol},NamedTuple{(:color,),Tuple{Array{RGBA{Float32},1}}}}, ::typeof(GeometryBasics.meta), ::Array{Point{2,Float32},1})
at: ~/.julia/packages/GeometryBasics/dwE6R/src/metadata.jl:111
[3] #pointmeta#160 GeometryBasics (::Base.Iterators.Pairs{Symbol,Array{RGBA{Float32},1},Tuple{Symbol},NamedTuple{(:color,),Tuple{Array{RGBA{Float32},1}}}}, ::typeof(GeometryBasics.pointmeta), ::GeometryBasics.Mesh{2,Float32,GeometryBas ...99+)
at: ~/.julia/packages/GeometryBasics/dwE6R/src/meshes.jl:245
[4] #123 GLMakie (::GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}}}}, ::Array{RGBA{Float32},1}, ::Nothing, ::Nothing)
at: ~/.julia/dev/GLMakie/src/drawing_primitives.jl:383
[5] MapUpdater Observables (::GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}}}}, ::Vararg{Any,N} where N)
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:241
[6] OnUpdate Observables (::Array{RGBA{Float32},1})
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:218
[7] #setindex!#5 Observables (::Observables.var"#6#8", ::typeof(setindex!), ::Observable{Array{RGBA{Float32},1}}, ::Array{RGBA{Float32},1})
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:130
julia> cs[] = to_colormap(:viridis, 4)
ERROR: Metadata array needs to have same length as data.
Found 16 data items, and 152 metadata items
Stacktrace:
Function Module Signature
──────── ────── ─────────
[1] error Base (::String)
at: /Applications/Julia-1.5.app/Contents/Resources/julia/bin/../share/julia/base/error.jl:33
[2] #meta#86 GeometryBasics (::Base.Iterators.Pairs{Symbol,Array{RGBA{Float32},1},Tuple{Symbol},NamedTuple{(:color,),Tuple{Array{RGBA{Float32},1}}}}, ::typeof(GeometryBasics.meta), ::Array{Point{2,Float32},1})
at: ~/.julia/packages/GeometryBasics/dwE6R/src/metadata.jl:111
[3] #pointmeta#160 GeometryBasics (::Base.Iterators.Pairs{Symbol,Array{RGBA{Float32},1},Tuple{Symbol},NamedTuple{(:color,),Tuple{Array{RGBA{Float32},1}}}}, ::typeof(GeometryBasics.pointmeta), ::GeometryBasics.Mesh{2,Float32,GeometryBas ...99+)
at: ~/.julia/packages/GeometryBasics/dwE6R/src/meshes.jl:245
[4] #123 GLMakie (::GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}}}}, ::Array{RGBA{Float32},1}, ::Nothing, ::Nothing)
at: ~/.julia/dev/GLMakie/src/drawing_primitives.jl:383
[5] MapUpdater Observables (::GeometryBasics.Mesh{2,Float32,GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}},FaceView{GeometryBasics.Ngon{2,Float32,3,Point{2,Float32}}}}, ::Vararg{Any,N} where N)
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:241
[6] OnUpdate Observables (::Array{RGBA{Float32},1})
at: ~/.julia/packages/Observables/0wrF6/src/Observables.jl:218
[7] #setindex!#5 Observables (::Observables.var"#6#8", ::typeof(setindex!), ::Observable{Array{RGBA{Float32},1}}, ::Array{RGBA{Float32},1})
at: ~/.julia/packages/Observables/0wrF6/src/ |
It looks like at each call another 16 are added. Not sure if it's relevant. |
@asinghvi17 sorry to invade the issue for something off-topic, but how did you get this nice presentation of stacktraces? |
See https://github.com/jkrumbiegel/ClearStacktrace.jl (This may also be of interest JuliaLang/julia#36026) |
Hmm...16 is 4x4, 4 vertices per bar x 4 bars. |
Fixed in: JuliaPlots/AbstractPlotting.jl#444 |
MWE
If I replace
barplot
withscatter
, it works.The error is
Verision info
I can also reproduce it with an older julia version
The text was updated successfully, but these errors were encountered: