Skip to content

Broken errorbar legend interactivity #5444

@egavazzi

Description

@egavazzi

When clicking on the legend element of an errobar plot, I get the following error:

julia> Error in callback:
Cannot attach input with name visible - already exists!
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:44
  [2] _add_input!(func::Function, attr::ComputePipeline.ComputeGraph, key::Symbol, value::Bool)
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:717
  [3] add_input!
    @ ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:696 [inlined]
  [4] setproperty!(plot::LineSegments{Tuple{Vector{Point{2, Float64}}}}, key::Symbol, val::Bool)
    @ Makie ~/.julia/packages/Makie/TOy8O/src/compute-plots.jl:94
  [5] (::Makie.var"#toggle_visibility!##0#toggle_visibility!##1"{Bool})(p::LineSegments{Tuple{Vector{Point{2, Float64}}}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/makielayout/blocks/legend.jl:1160
  [6] foreach_plot(f::Makie.var"#toggle_visibility!##0#toggle_visibility!##1"{Bool}, entry::LegendEntry)
    @ Makie ~/.julia/packages/Makie/TOy8O/src/makielayout/blocks/legend.jl:1151
  [7] toggle_visibility!
    @ ~/.julia/packages/Makie/TOy8O/src/makielayout/blocks/legend.jl:1159 [inlined]
  [8] _toggle_hovered_legend_visibilities!(mpos::Tuple{Float64, Float64}, entry_groups::Vector{Tuple{Any, Vector{LegendEntry}}}, entryshades::Vector{Vector{Box}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/makielayout/blocks/legend.jl:21
  [9] (::Makie.var"#2157#2158"{Events, Vector{Vector{Box}}, Observable{GeometryBasics.HyperRectangle{2, Int64}}, Observable{Vector{Tuple{Any, Vector{LegendEntry}}}}})(event::Makie.MouseButtonEvent)
    @ Makie ~/.julia/packages/Makie/TOy8O/src/makielayout/blocks/legend.jl:365
 [10] notify
    @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
 [11] setindex!
    @ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123 [inlined]
 [12] (::GLMakie.var"#mousebuttons#mousebuttons##0"{Observable{Makie.MouseButtonEvent}})(window::GLFW.Window, button::GLFW.MouseButton, action::GLFW.Action, mods::Int32)
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/events.jl:104
 [13] _MouseButtonCallbackWrapper(window::GLFW.Window, button::GLFW.MouseButton, action::GLFW.Action, mods::Int32)
    @ GLFW ~/.julia/packages/GLFW/Zwulj/src/callback.jl:46
 [14] macro expansion
    @ ~/.julia/packages/GLFW/Zwulj/src/GLFW.jl:34 [inlined]
 [15] PollEvents
    @ ~/.julia/packages/GLFW/Zwulj/src/glfw3.jl:753 [inlined]
 [16] pollevents(screen::GLMakie.Screen{GLFW.Window}, frame_state::Makie.TickState)
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/screen.jl:559
 [17] (::GLMakie.var"#on_demand_renderloop##0#on_demand_renderloop##1"{GLMakie.Screen{GLFW.Window}})()
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/screen.jl:1092
 [18] with_context(f::GLMakie.var"#on_demand_renderloop##0#on_demand_renderloop##1"{GLMakie.Screen{GLFW.Window}}, context::GLFW.Window)
    @ GLMakie.GLAbstraction ~/.julia/packages/GLMakie/KTGTK/src/GLAbstraction/GLAbstraction.jl:59
 [19] on_demand_renderloop(screen::GLMakie.Screen{GLFW.Window})
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/screen.jl:1091
 [20] renderloop(screen::GLMakie.Screen{GLFW.Window})
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/screen.jl:1119
 [21] (::GLMakie.var"#start_renderloop!##0#start_renderloop!##1"{GLMakie.Screen{GLFW.Window}})()
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/screen.jl:945

MWE:

using GLMakie

f = Figure()
Axis(f[1, 1])

xs = 0:0.5:10
ys = 0.5 .* sin.(xs)

lowerrors = fill(0.1, length(xs))
higherrors = LinRange(0.1, 0.4, length(xs))

errorbars!(xs, ys, higherrors; color = :red, label="data") # same low and high error

axislegend()

f

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions