MakieOrg / Makie.jl

Interactive data visualizations and plotting in Julia
https://docs.makie.org/stable
MIT License
2.4k stars 307 forks source link

Scatterlines does not work #509

Closed sethaxen closed 1 month ago

sethaxen commented 4 years ago
julia> scatterlines(randn(5), randn(5))
Error showing value of type Scene:
ERROR: MethodError: no method matching gl_convert(::Type{GeometryTypes.HyperSphere{2,T} where T})
Closest candidates are:
  gl_convert(::Nothing) at /Users/saxen/.julia/packages/GLMakie/FqQ46/src/GLAbstraction/GLUniforms.jl:202
  gl_convert(::GLMakie.GLAbstraction.GLProgram, ::Any) at /Users/saxen/.julia/packages/GLMakie/FqQ46/src/GLAbstraction/GLShader.jl:114
  gl_convert(::GLMakie.GLAbstraction.AbstractLazyShader, ::Any) at /Users/saxen/.julia/packages/GLMakie/FqQ46/src/GLAbstraction/GLShader.jl:221

Seems to be that lines doesn't like the Circle marker being passed to it. marker=:circle is no better though:

julia> scatterlines(randn(5), randn(5); marker = :circle)
Error showing value of type Scene:
ERROR: MethodError: no method matching gl_convert(::Symbol)
Closest candidates are:
  gl_convert(::Nothing) at /Users/saxen/.julia/packages/GLMakie/FqQ46/src/GLAbstraction/GLUniforms.jl:202
  gl_convert(::GLMakie.GLAbstraction.GLProgram, ::Any) at /Users/saxen/.julia/packages/GLMakie/FqQ46/src/GLAbstraction/GLShader.jl:114
  gl_convert(::GLMakie.GLAbstraction.AbstractLazyShader, ::Any) at /Users/saxen/.julia/packages/GLMakie/FqQ46/src/GLAbstraction/GLShader.jl:221
sethaxen commented 4 years ago

FWIW, this comes up for me a lot. I guess I would hope that unused kwargs passed to a plotting recipe would just be ignored, but if they're arrays, symbols, Automatic or a few other things, it seems to raise these errors, so where recipes have kwargs that map to different plotting functions called internally, I often need to manually divide them out.

asinghvi17 commented 4 years ago

This error is specific to the GLMakie backend, which tries to convert all attributes. Per our last discussion, at least, this is intentional.

Would you like a Theme(attrs, plot, ::PlotType) function you can call to remove all attributes which are not in the default theme of that plot type, and merge in defaults as necessary?

sethaxen commented 4 years ago

Would you like a Theme(attrs, plot, ::PlotType) function you can call to remove all attributes which are not in the default theme of that plot type, and merge in defaults as necessary?

What would attrs do in this function?

asinghvi17 commented 4 years ago

attrs is the set of attributes you want to filter.

sethaxen commented 4 years ago

I guess what I would like to do is, given my plot MyPlot and another plot type BasePlot, get all attributes of MyPlot that are also attributes of BasePlot (implicitly removing the rest). Is that what you mean?

What I'm concerned about and what I speculate has happened here with scatterlines is that someone creates a recipe whose theme uses the default_theme for other plots and everything works. But then someone adds a new theme attribute to one of those plots, and now this user's recipe doesn't work anymore. It just makes recipes harder to maintain. I don't know what the solution is.

piever commented 4 years ago

I've encountered the same problem with QQPlot recipe (which is being ported in https://github.com/JuliaPlots/AbstractPlotting.jl/pull/478). I'm also not sure what would be a good solution.

ffreyer commented 1 month ago

This has been fixed