Skip to content

attribute values change even without assignments #5348

@aplavin

Description

@aplavin

MWE:

  • recipe definition
	@recipe MyLines (positions,) begin
	    Makie.documented_attributes(Lines)...
	end
	
	
	function Makie.plot!(p::MyLines)
		att = Makie.shared_attributes(p, Lines)
		lines!(p, att, p.positions; color=(:red, 0.02), linewidth=@lift $(att.linewidth) + 100)
	    lines!(p, att, p.positions)
	    return p
	end
  • usage: mylines(rand(100))
  • result:
Image

The problem is, att.linewidth gets modified after the first call to lines!, even though it's clearly not intended.
Even weirder, the problem goes away if attributes(p) is used instead of Makie.shared_attributes(p, Lines).

@SimonDanisch confirmed reproduction on slack; I don't if the issue is with computegraph/observables, or with shared_attributes.

  • what version of Makie are you running? (]st -m Makie) 0.24
  • can you reproduce the bug with a fresh environment ? (]activate --temp; add Makie) yes
  • What platform + GPU are you on? any
  • Which backend are you using? (GLMakie, CairoMakie, WGLMakie, RPRMakie) any
  • Please provide an minimal example of the failing code. If the problem is with the visualization, please provide a picture or video of it.

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