visual-studio-codejuliaijulia-notebookjulia-plotspgfplots

Interpret this Julia error message using PGFPlotsX - key error


I am witnessing strange behaviour with Julia 1.8.5 using the latest of Plots PGFPlots(X) packages.

When adding the call pgfplotsx() I am not getting any output. A MWE is

using Plots
plot(rand(20))

gives the desired output but

using Plots
pgfplotsx()
plot(rand(20))

results in blank output.

What is going on or how could I debug this?

When installing Julia packages, there were problems with a package called init. Could that be related to this problem?

I had the idea to run it in a REPL and that gave me a much-needed error message. Can someone help me interpret it?

Error showing value of type Plots.Plot{Plots.PGFPlotsXBackend}:
ERROR: Invalid pgf key PGFPlotsX.Options(OrderedCollections.OrderedDict{String, Any}("color" => RGBA{Float64}(0.0,0.0,0.0,1.0), "draw opacity" => 1.0, "line width" => 1, "solid" => nothing), false)
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] normalize_key(x::PGFPlotsX.Options)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/wtVR1/src/options.jl:10
  [3] PGFPlotsX.Options(::Pair{PGFPlotsX.Options, Nothing}, ::Vararg{Union{PGFPlotsX.MergeEntry, Pair}}; print_empty::Bool)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/wtVR1/src/options.jl:46
  [4] PGFPlotsX.Options(::Pair{PGFPlotsX.Options, Nothing}, ::Vararg{Union{PGFPlotsX.MergeEntry, Pair}})
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/wtVR1/src/options.jl:41
  [5] pgfx_get_legend_style(sp::Plots.Subplot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/tDHxD/src/backends/pgfplotsx.jl:768
  [6] (::Plots.PGFPlotsXPlot)(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/tDHxD/src/backends/pgfplotsx.jl:142
  [7] _update_plot_object(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/tDHxD/src/backends/pgfplotsx.jl:1351
  [8] prepare_output(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/tDHxD/src/plot.jl:257
  [9] display(#unused#::Plots.PlotsDisplay, plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/tDHxD/src/output.jl:168
 [10] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
 [11] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [12] invokelatest
    @ ./essentials.jl:726 [inlined]
 [13] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/REPL.jl:296
 [14] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/REPL.jl:278
 [15] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/REPL.jl:521
 [16] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/REPL.jl:276
 [17] (::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 /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/REPL.jl:857
 [18] #invokelatest#2
    @ ./essentials.jl:729 [inlined]
 [19] invokelatest
    @ ./essentials.jl:726 [inlined]
 [20] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/LineEdit.jl:2510
 [21] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /Applications/Julia-1.8.app/Contents/Resources/julia/share/julia/stdlib/v1.8/REPL/src/REPL.jl:1248
 [22] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:484

Solution

  • It’s a bug that was recently fixed. Try updating Plots. It should work using v1.38.12.