I want to change the linestyle of lines in an axis using an observable for the linestyle. When using the little code snippet below, it works for setting the linestyle to :dot, :dash, :dotdash, but not for setting the linestyle to :solid. Is this intentional or a bug? When I misspell a linestyle symbol, I get an error that lists :solid as a valid linestyle option (i.e., ERROR: Unknown linestyle: dotdash. Available line styles are: :solid, :dash, :dot, :dashdot, :dashdotdot, or a sequence of numbers enumerating the next transparent/opaque region. …). If this is not a bug, how would I have to change the code to change the linestyle of the line after it is inserted into the axis?
I ran the code with Julia v1.10.2 and GLMakie v0.9.9.
f = Figure()
ax = Axis(f[1, 1])
display(f)
ls = Observable{Symbol}(:dot)
lines!(ax, 1:100, rand(100), linestyle=ls)
ls[] = :dash # ok
ls[] = :dashdot # ok
ls[] = :dashdotdot # ok
ls[] = :solid # ERROR
ERROR: MethodError: Cannot `convert` an object of type Nothing to an object of type Vector{Float32}
Closest candidates are:
convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, N, Array{T, N}}) where {S, T, N}
@ StaticArrays ~/.julia/packages/StaticArrays/EHHaF/src/SizedArray.jl:88
convert(::Type{Array{T, N}}, ::StaticArraysCore.SizedArray{S, T, N, M, TData} where {M, TData<:AbstractArray{T, M}}) where {T, S, N}
@ StaticArrays ~/.julia/packages/StaticArrays/EHHaF/src/SizedArray.jl:82
convert(::Type{T}, ::T) where T
@ Base Base.jl:84
...
Stacktrace:
[1] setproperty!(x::Observable{Vector{Float32}}, f::Symbol, v::Nothing)
@ Base ./Base.jl:40
[2] setindex!(observable::Observable, val::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:122
[3] (::Observables.MapCallback)(value::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:436
[4] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[5] invokelatest
@ ./essentials.jl:889 [inlined]
[6] notify
@ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
[7] setindex!(observable::Observable, val::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123
[8] (::Observables.SetindexCallback)(x::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:148
[9] #invokelatest#2
@ ./essentials.jl:892 [inlined]
[10] invokelatest
@ ./essentials.jl:889 [inlined]
[11] notify
@ ~/.julia/packages/Observables/YdEbO/src/Observables.jl:206 [inlined]
[12] setindex!(observable::Observable, val::Any)
@ Observables ~/.julia/packages/Observables/YdEbO/src/Observables.jl:123
[13] top-level scope
@ ~/Desktop/test.jl:19