I found a code that I could execute a year ago (last time I executed was November 14th 2023, I think) but with packages updated as today it gives error. I could simplify the code to this MWE:
y1 = [1 2 3 ; 4 5 6; 7 8 9]
y2 = [1 NaN 3; 4 NaN 6; 7 NaN 9]
y3 = [NaN 2 3; NaN 5 6; NaN 8 9]
y4 = [1 2 3; NaN 5 6; NaN 8 9]
x = [1,2,3]
plot(x,y1, linez = [1,2,3], colorbar = true)
plot(x,y2, linez = [1,2,3], colorbar = true)
plot(x,y3, linez = [1,2,3], colorbar = true)
plot(x,y4, linez = [1,2,3], colorbar = true)
The first two plots are well executed, the problem is when the array contains its first column full of NaN or when only one element in first column is not NaN.
The code can execute well if linez = [1,2,3], colorbar = true
is absent.
The error it produces is the following:
ERROR: BoundsError: attempt to access 0-element Vector{Any} at index [0]
Stacktrace:
[1] throw_boundserror(A::Vector{Any}, I::Tuple{Int64})
@ Base .\essentials.jl:14
[2] getindex(A::Vector{Any}, i::Int64)
@ Base .\essentials.jl:916
[3] _before_layout_calcs(plt::Plots.Plot{Plots.PyPlotBackend})
@ Plots C:\Users\PC\.julia\packages\Plots\sxUvK\src\backends\deprecated\pyplot.jl:980
[4] prepare_output(plt::Plots.Plot{Plots.PyPlotBackend})
@ Plots C:\Users\PC\.julia\packages\Plots\sxUvK\src\plot.jl:232
[5] show
@ C:\Users\PC\.julia\packages\Plots\sxUvK\src\output.jl:231 [inlined]
[6] __binrepr(m::MIME{Symbol("image/svg+xml")}, x::Plots.Plot{Plots.PyPlotBackend}, context::Nothing)
@ Base.Multimedia .\multimedia.jl:171
[7] _textrepr
@ .\multimedia.jl:163 [inlined]
[8] stringmime(m::MIME{Symbol("image/svg+xml")}, x::Plots.Plot{Plots.PyPlotBackend})
@ Base64 C:\Users\PC\.julia\juliaup\julia-1.11.1+0.x64.w64.mingw32\share\julia\stdlib\v1.11\Base64\src\Base64.jl:44
[9] display(d::VSCodeServer.InlineDisplay, m::MIME{Symbol("image/svg+xml")}, x::Any)
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\display.jl:68
[10] display(d::VSCodeServer.InlineDisplay, mime::String, x::Any)
@ Base.Multimedia .\multimedia.jl:228
[11] display(d::VSCodeServer.InlineDisplay, x::Any)
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\display.jl:207
[12] display(x::Any)
@ Base.Multimedia .\multimedia.jl:340
[13] #invokelatest#2
@ .\essentials.jl:1055 [inlined]
[14] invokelatest
@ .\essentials.jl:1052 [inlined]
[15] (::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\eval.jl:237
[16] withpath(f::VSCodeServer.var"#69#74"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\repl.jl:276
[17] (::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\eval.jl:179
[18] hideprompt(f::VSCodeServer.var"#68#73"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\repl.jl:38
[19] #67
@ c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\eval.jl:150 [inlined]
[20] with_logstate(f::VSCodeServer.var"#67#72"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, logstate::Base.CoreLogging.LogState)
@ Base.CoreLogging .\logging\logging.jl:522
[21] with_logger
@ .\logging\logging.jl:632 [inlined]
[22] (::VSCodeServer.var"#66#71"{VSCodeServer.ReplRunCodeRequestParams})()
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\eval.jl:263
[23] #invokelatest#2
@ .\essentials.jl:1055 [inlined]
[24] invokelatest(::Any)
@ Base .\essentials.jl:1052
[25] (::VSCodeServer.var"#64#65")()
@ VSCodeServer c:\Users\PC\.vscode\extensions\julialang.language-julia-1.127.2\scripts\packages\VSCodeServer\src\eval.jl:34