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

[BUG] Empty 3D scatter plots result in an error in GR #4146

Closed
fhagemann opened this issue Mar 23, 2022 · 8 comments · Fixed by JuliaPlots/RecipesPipeline.jl#110
Closed

[BUG] Empty 3D scatter plots result in an error in GR #4146

fhagemann opened this issue Mar 23, 2022 · 8 comments · Fixed by JuliaPlots/RecipesPipeline.jl#110
Labels

Comments

@fhagemann
Copy link
Contributor

fhagemann commented Mar 23, 2022

Details

Plotting an empty scatter plot (scatter([],[])) works in 2D in GR.
scatter2D

It, however, fails in 3D (scatter([],[],[])) with a very cryptic error message:

BoundsError: attempt to access 0-element Vector{Tuple{Float64, Float64, Float64}} at index [1]

Stacktrace:
  [1] getindex
    @ ./array.jl:839 [inlined]
  [2] unzip(v::Vector{Tuple{Float64, Float64, Float64}})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/oVorB/src/utils.jl:211
  [3] gr_add_series(sp::Plots.Subplot{Plots.GRBackend}, series::Plots.Series)
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:1845
  [4] gr_display(sp::Plots.Subplot{Plots.GRBackend}, w::Measures.AbsoluteLength, h::Measures.AbsoluteLength, viewport_canvas::Vector{Float64})
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:1005
  [5] gr_display(plt::Plots.Plot{Plots.GRBackend}, fmt::String)
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:670
  [6] _show(io::IOBuffer, #unused#::MIME{Symbol("image/svg+xml")}, plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:2169
  [7] show(io::IOBuffer, m::MIME{Symbol("image/svg+xml")}, plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/8K4be/src/output.jl:205
  [8] sprint(::Function, ::MIME{Symbol("image/svg+xml")}, ::Vararg{Any}; context::Nothing, sizehint::Int64)
    @ Base ./strings/io.jl:112
  [9] sprint
    @ ./strings/io.jl:106 [inlined]
 [10] _ijulia_display_dict(plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/8K4be/src/ijulia.jl:47
 [11] display_dict(plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/8K4be/src/init.jl:92
 [12] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [13] invokelatest
    @ ./essentials.jl:714 [inlined]
 [14] execute_request(socket::ZMQ.Socket, msg::IJulia.Msg)
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/execute_request.jl:112
 [15] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [16] invokelatest
    @ ./essentials.jl:714 [inlined]
 [17] eventloop(socket::ZMQ.Socket)
    @ IJulia ~/.julia/packages/IJulia/e8kqU/src/eventloop.jl:8
 [18] (::IJulia.var"#15#18")()
    @ IJulia ./task.jl:411

Backends

This bug occurs on ( insert x below )

Backend yes no untested
gr (default) X
pyplot X
plotlyjs X
pgfplotsx X
unicodeplots X
inspectdr X
gaston X

Versions

Plots.jl version: 1.27.1
Backend version (]st -m <backend(s)>): GR v0.64.0
Output of versioninfo():

Julia Version 1.7.0-rc1
Commit 9eade6195e (2021-09-12 06:45 UTC)
Platform Info:
  OS: Linux (x86_64-pc-linux-gnu)
  CPU: Intel(R) Core(TM) i5-6200U CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
  JULIA_NUM_THREADS = 32
@t-bltg
Copy link
Member

t-bltg commented Mar 23, 2022

I cannot reproduce on 1.6.5 nor 1.7.2.
You are using Julia Version 1.7.0-rc1 which by definition (rc) is unsupported. Please update your julia version, and come back with a working mwe ?

@BeastyBlacksmith
Copy link
Member

I can reproduce this on 1.7.2, i also get a warning about an unsupported keyword argument letter which shouldn't appear

@t-bltg
Copy link
Member

t-bltg commented Mar 23, 2022

Can you post your backtrace as well ?
I see svg+xml references, so there must be some save commands involved.

@BeastyBlacksmith
Copy link
Member

ERROR: BoundsError: attempt to access 0-element Vector{Tuple{Float64, Float64, Float64}} at index [1]
Stacktrace:
  [1] getindex
    @ ./array.jl:861 [inlined]
  [2] unzip(v::Vector{Tuple{Float64, Float64, Float64}})
    @ RecipesPipeline ~/.julia/packages/RecipesPipeline/oVorB/src/utils.jl:211
  [3] gr_add_series(sp::Plots.Subplot{Plots.GRBackend}, series::Plots.Series)
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:1845
  [4] gr_display(sp::Plots.Subplot{Plots.GRBackend}, w::Measures.AbsoluteLength, h::Measures.AbsoluteLength, viewport_canvas::Vector{Float64})
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:1005
  [5] gr_display(plt::Plots.Plot{Plots.GRBackend}, fmt::String)
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:670
  [6] gr_display
    @ ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:636 [inlined]
  [7] _display(plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/8K4be/src/backends/gr.jl:2199
  [8] display(#unused#::Plots.PlotsDisplay, plt::Plots.Plot{Plots.GRBackend})
    @ Plots ~/.julia/packages/Plots/8K4be/src/output.jl:139
  [9] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [10] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [11] invokelatest
    @ ./essentials.jl:714 [inlined]
 [12] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:293
 [13] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:277
 [14] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:510
 [15] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:275
 [16] (::REPL.var"#do_respond#66"{Bool, Bool, REPL.var"#77#87"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
    @ REPL ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:846
 [17] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [18] invokelatest
    @ ./essentials.jl:714 [inlined]
 [19] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:2493
 [20] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL ~/.asdf/installs/julia/1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:1232
 [21] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:423

@BeastyBlacksmith
Copy link
Member

Probably he ran it from a notebook

@t-bltg
Copy link
Member

t-bltg commented Mar 23, 2022

Ok thanks, sorry for the noise, I had a --check-bounds=no in my julia launcher.

@fhagemann
Copy link
Contributor Author

Thanks for solving this issue that quickly!

@t-bltg
Copy link
Member

t-bltg commented Mar 23, 2022

It looks like github CI / actions are hanging so this might take a while to get the new version in registry for updating:
JuliaRegistries/General#57159.

https://www.githubstatus.com/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants