Skip to content
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

MethodError updating Observable linestyle #803

Open
yha opened this issue Jan 3, 2021 · 1 comment · May be fixed by #4570
Open

MethodError updating Observable linestyle #803

yha opened this issue Jan 3, 2021 · 1 comment · May be fixed by #4570
Labels
enhancement Feature requests and enhancements GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. lines Makie Backend independent issues (Makie core) WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.

Comments

@yha
Copy link
Contributor

yha commented Jan 3, 2021

Looks like linestyle can't be updated at all. Example:

style = Observable(:dot)
scene = lines(rand(5), linestyle = style)
display(scene)
style[] = :solid 
# MethodError: Cannot `convert` an object of type Nothing to an object of type Array{Float64,1}

If :dot and :solid are swapped in this example, there's a different error:

MethodError: convert(::Type{Union{}}, ::Array{Float64,1}) is ambiguous
@ffreyer ffreyer added enhancement Feature requests and enhancements Makie Backend independent issues (Makie core) GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie. labels Aug 22, 2024
@ffreyer
Copy link
Collaborator

ffreyer commented Aug 22, 2024

You can't switch between :solid and another linestyle because they result in different shader code. You can switch between different patterns, e.g. :dot and :dash.

We could fix this by treating solid lines as dashed lines with infinite dash length. The patterned line code-path is significantly more expensive though. I've been thinking it might a good compromise to make nothing use the fast path and :solid be a pseudo-dashed line.
The change for this should actually be very simple - just replace this with Float64[0] (or maybe Float64[0, 1e30]) and document

Makie.jl/src/conversions.jl

Lines 1114 to 1115 in 2b5931e

if ls === :solid
return nothing

Related #3641

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature requests and enhancements GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. lines Makie Backend independent issues (Makie core) WGLMakie This relates to WGLMakie.jl, the Web-based WebGL backend for Makie.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants