Skip to content

Can't plot quantities with units onto Axis3 #5458

@rrwormqueen

Description

@rrwormqueen

In one of the recent releases, the patches say

Add dim conversion support for Axis3 #4964.

Unfortunately, I can't even get a minimal example to work:

using Makie
using Unitful
fig = Figure()
ax = Axis3(fig[1,1],
   dim1_conversion = Makie.UnitfulConversion(u"m", units_in_label = false),
   dim2_conversion = Makie.UnitfulConversion(u"m", units_in_label = false),
   dim3_conversion = Makie.UnitfulConversion(u"m", units_in_label = false),
)
domain = [Point3(rand(), rand(), rand())u"m" for i  1:10]
scatter!(ax, domain)

The expected result is a 3D scatter of 10 random points. Instead, we get the error:

julia> scatter!(ax, domain)
ERROR: Failed to resolve gl_renderobject:
[ComputeEdge] gl_renderobject = #register_robj!##0((alpha_colormap, scaled_color, scaled_colorrange, sdf_marker_shape, positions_transformed_f32c, sdf_uv, quad_scale, quad_offset, image, lowclip_color, highclip_color, nan_color, strokecolor, strokewidth, glowcolor, glowwidth, model_f32c, converted_rotation, billboard, transform_marker, gl_indices, gl_len, marker_offset, f32c_scale, uniform_clip_planes, uniform_num_clip_planes, depth_shift, visible, fxaa, resolution, projection, projectionview, view, upvector, eyeposition, view_direction, preprojection, ), changed, cached)
  @ /home/worm/.julia/packages/GLMakie/KTGTK/src/plot-primitives.jl:245
[ComputeEdge] positions_transformed_f32c = #366((positions_transformed, model, f32c, space, ), changed, cached)
  @ /home/worm/.julia/packages/Makie/TOy8O/src/compute-plots.jl:331
  with edge inputs:
    positions_transformed = Point3{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}[[0.750417607220316 m, 0.7127298931412955 m, 0.7025909812627407 m], [0.4895508568397271 m, 0.1855690190149084 m, 0.8820675323180015 m], [0.5729038592424313 m, 0.2502313860057377 m, 0.08963392334296627 m], [0.4310542359122629 m, 0.9910919478537437 m, 0.6518468470130376 m], [0.006549195046258505 m, 0.86901019467461 m, 0.6849002915313332 m], [0.6655741641828532 m, 0.5279412827860058 m, 0.6183831784911387 m], [0.44519347222688954 m, 0.6578189602632843 m, 0.9345952184344893 m], [0.924478348751685 m, 0.9942119358626905 m, 0.37681486104471673 m], [0.17048379736086694 m, 0.12736387968096174 m, 0.3728385228267913 m], [0.2916207263402012 m, 0.4101737446068655 m, 0.25561786255792474 m]]
    model = [2.0 0.0 0.0 -1.0; 0.0 2.0 0.0 -1.0; 0.0 0.0 1.3333333333333333 -0.6666666666666666; 0.0 0.0 0.0 1.0]
    f32c = nothing
    space = :data
Triggered by update of:
  arg1, transform_func, f32c, space or model
Due to ERROR: TypeError: in Type, in parameter, expected Type, got a value of type MethodError
Stacktrace:
  [1] float32type(::Type{Point3{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/conversions.jl:783
  [2] float32type(::Vector{Point3{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/conversions.jl:792
  [3] el32convert(x::Vector{Point3{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/conversions.jl:798
  [4] #366
    @ ~/.julia/packages/Makie/TOy8O/src/compute-plots.jl:334 [inlined]
  [5] ComputePipeline.TypedEdge(edge::ComputePipeline.ComputeEdge{…}, f::Makie.var"#366#367", inputs::@NamedTuple{})
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:126
  [6] ComputePipeline.TypedEdge(edge::ComputePipeline.ComputeEdge{ComputePipeline.ComputeGraph})
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:120
  [7] (::ComputePipeline.var"#resolve!##4#resolve!##5"{ComputePipeline.ComputeEdge{ComputePipeline.ComputeGraph}})()
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:664
  [8] lock(f::ComputePipeline.var"#resolve!##4#resolve!##5"{ComputePipeline.ComputeEdge{}}, l::ReentrantLock)
    @ Base ./lock.jl:335
  [9] resolve!(edge::ComputePipeline.ComputeEdge{ComputePipeline.ComputeGraph})
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:659
 [10] _resolve!(computed::ComputePipeline.Computed)
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:652
 [11] foreach
    @ ./abstractarray.jl:3188 [inlined]
 [12] (::ComputePipeline.var"#resolve!##4#resolve!##5"{ComputePipeline.ComputeEdge{ComputePipeline.ComputeGraph}})()
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:661
 [13] lock(f::ComputePipeline.var"#resolve!##4#resolve!##5"{ComputePipeline.ComputeEdge{}}, l::ReentrantLock)
    @ Base ./lock.jl:335
 [14] resolve!(edge::ComputePipeline.ComputeEdge{ComputePipeline.ComputeGraph})
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:659
 [15] _resolve!(computed::ComputePipeline.Computed)
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:652
 [16] resolve!(computed::ComputePipeline.Computed)
    @ ComputePipeline ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:644
 [17] getindex
    @ ~/.julia/packages/ComputePipeline/VcOdn/src/ComputePipeline.jl:563 [inlined]
 [18] register_robj!(constructor!::Function, screen::GLMakie.Screen{…}, scene::Scene, plot::Scatter{…}, inputs::Vector{…}, uniforms::Vector{…}, input2glname::Dict{…})
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/plot-primitives.jl:259
 [19] draw_atomic(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, plot::Scatter{Tuple{Vector{Point3{Quantity{}}}}})
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/plot-primitives.jl:408
 [20] insert!(screen::GLMakie.Screen{GLFW.Window}, scene::Scene, x::Plot)
    @ GLMakie ~/.julia/packages/GLMakie/KTGTK/src/plot-primitives.jl:14
 [21] push!(scene::Scene, plot::Plot)
    @ Makie ~/.julia/packages/Makie/TOy8O/src/scenes.jl:515
 [22] plot!
    @ ~/.julia/packages/Makie/TOy8O/src/interfaces.jl:212 [inlined]
 [23] plot!(ax::Axis3, plot::Scatter{Tuple{Vector{Point3{Quantity{Float64, 𝐋, Unitful.FreeUnits{(m,), 𝐋, nothing}}}}}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/figureplotting.jl:437
 [24] _create_plot!(::Function, ::Dict{Symbol, Any}, ::Axis3, ::Vector{Point3{Quantity{Float64, 𝐋, Unitful.FreeUnits{}}}})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/figureplotting.jl:407
 [25] scatter!(::Axis3, ::Vararg{Any}; kw::@Kwargs{})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/recipes.jl:534
 [26] scatter!(::Axis3, ::Vararg{Any})
    @ Makie ~/.julia/packages/Makie/TOy8O/src/recipes.jl:532
 [27] top-level scope
    @ REPL[8]:1
Some type information was truncated. Use `show(err)` to see complete types.

I've fiddled with this for quite a long time, but I can't find any fix. Critically, this bug is with GLMakie, because this example works fine on a CairoMakie backend. Unfortunately, I really need the features of GLMakie. Am I using the API wrong? My setup is:

Operating System: Fedora Linux 43
Qt Version: 6.10.1
Kernel Version: 6.17.8-300.fc43.x86_64 (64-bit)
Graphics Platform: Wayland
Processors: 18 × Intel® Core™ Ultra 5 125H
Graphics Processor: Intel® Graphics
Manufacturer: Framework
Makie v0.24.7

Thanks!

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