-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Plot breaks when adding incorrect input #1908
Comments
This error also happens when you have a legend with a couple of labels, and you want to add a couple more. You can't just add a label for the added line.
|
Also note that plot only sometimes throws an error when lengths are mismatched: julia> using Plots
julia> plot([], [3,4,5]) # Works
WARNING: importing deprecated binding Colors.RGB1 into PlotUtils.
WARNING: importing deprecated binding Colors.RGB1 into Plots.
WARNING: importing deprecated binding Colors.RGB4 into PlotUtils.
WARNING: importing deprecated binding Colors.RGB4 into Plots.
julia> plot([1], [3,4,5]) # Works
julia> plot([1, 2], [3,4,5])
Error showing value of type Plots.Plot{Plots.GRBackend}:
ERROR: BoundsError: attempt to access 1-element Vector{Float64} at index [1:2]
Stacktrace:
[1] throw_boundserror(A::Vector{Float64}, I::Tuple{UnitRange{Int64}})
@ Base ./abstractarray.jl:651
[2] checkbounds
@ ./abstractarray.jl:616 [inlined]
[3] getindex(A::Vector{Float64}, I::UnitRange{Int64})
@ Base ./array.jl:807
[4] gr_draw_segments(series::Plots.Series, x::Vector{Float64}, y::Vector{Float64}, fillrange::Nothing, clims::Tuple{Float64, Float64})
@ Plots ~/.julia/packages/Plots/iYDwd/src/backends/gr.jl:1722
[5] gr_add_series(sp::Plots.Subplot{Plots.GRBackend}, series::Plots.Series)
@ Plots ~/.julia/packages/Plots/iYDwd/src/backends/gr.jl:1637
[6] gr_display(sp::Plots.Subplot{Plots.GRBackend}, w::Measures.AbsoluteLength, h::Measures.AbsoluteLength, viewport_canvas::Vector{Float64})
@ Plots ~/.julia/packages/Plots/iYDwd/src/backends/gr.jl:955
[7] gr_display(plt::Plots.Plot{Plots.GRBackend}, fmt::String)
@ Plots ~/.julia/packages/Plots/iYDwd/src/backends/gr.jl:646
[8] _show(io::IOContext{Base64.Base64EncodePipe}, #unused#::MIME{Symbol("image/png")}, plt::Plots.Plot{Plots.GRBackend})
@ Plots ~/.julia/packages/Plots/iYDwd/src/backends/gr.jl:1893
[9] _showjuno
@ ~/.julia/packages/Plots/iYDwd/src/output.jl:273 [inlined]
[10] showjuno(io::IOContext{Base64.Base64EncodePipe}, m::MIME{Symbol("image/png")}, plt::Plots.Plot{Plots.GRBackend})
@ Plots ~/.julia/packages/Plots/iYDwd/src/output.jl:257
[11] show(io::IOContext{Base64.Base64EncodePipe}, m::MIME{Symbol("image/png")}, plt::Plots.Plot{Plots.GRBackend})
@ Plots ~/.julia/packages/Plots/iYDwd/src/output.jl:212
[12] base64encode(::Function, ::MIME{Symbol("image/png")}, ::Vararg{Any, N} where N; context::IOContext{IOBuffer})
@ Base64 /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Base64/src/encode.jl:211
[13] _binstringmime
@ /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Base64/src/Base64.jl:46 [inlined]
[14] stringmime(m::MIME{Symbol("image/png")}, x::Plots.Plot{Plots.GRBackend}; context::IOContext{IOBuffer})
@ Base64 /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Base64/src/Base64.jl:43
[15] stringmime(m::String, x::Plots.Plot{Plots.GRBackend}; context::IOContext{IOBuffer})
@ Base64 /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/Base64/src/Base64.jl:44
[16] displayinplotpane(x::Plots.Plot{Plots.GRBackend})
@ Atom ~/.julia/packages/Atom/5NgzM/src/display/showdisplay.jl:84
[17] display(d::Atom.JunoDisplay, x::Plots.Plot{Plots.GRBackend})
@ Atom ~/.julia/packages/Atom/5NgzM/src/display/showdisplay.jl:118
[18] display(x::Any)
@ Base.Multimedia ./multimedia.jl:328
[19] #invokelatest#2
@ ./essentials.jl:708 [inlined]
[20] invokelatest
@ ./essentials.jl:706 [inlined]
[21] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:247
[22] (::REPL.var"#40#41"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:231
[23] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:462
[24] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:229
[25] (::REPL.var"#do_respond#61"{Bool, Bool, Atom.var"#246#247"{Module}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(s::REPL.LineEdit.MIState, buf::Any, ok::Bool)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:798
[26] #invokelatest#2
@ ./essentials.jl:708 [inlined]
[27] invokelatest
@ ./essentials.jl:706 [inlined]
[28] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
@ REPL.LineEdit /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/LineEdit.jl:2441
[29] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
@ REPL /Users/julia/buildbot/worker/package_macos64/build/usr/share/julia/stdlib/v1.6/REPL/src/REPL.jl:1126
[30] (::REPL.var"#44#49"{REPL.LineEditREPL, REPL.REPLBackendRef})()
@ REPL ./task.jl:411 |
This issue appears to be fixed - the middle call doesn't generate an error anymore. |
I'm still seeing this issue with Plots v1.38.0 |
|
My guess: Plots is not checking input data for compatible format, stores it as a plot series, and then repeatedly tries to read the bad data when rendering the plot.
Stacktrace:
The text was updated successfully, but these errors were encountered: