PGFPlotsX invalid pgf key error

Hello!

When running Version 1.9.0 (2023-05-07) with the latest PGFPlotsX the following snippet gives me this error message.

When using the generic plotting functions like so, I get the error message further below.

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

I am on Mac OS X 13.2.1 (Intel) and I can confirm that the following works as desired:

using PGFPlotsX

@pgf Axis(
           {
               xlabel = "Cost",
               ylabel = "Error",
           },
           Plot(
               {
                   color = "red",
                   mark  = "x"
               },
               Coordinates(
                   [
                       (2, -2.8559703),
                       (3, -3.5301677),
                       (4, -4.3050655),
                       (5, -5.1413136),
                       (6, -6.0322865),
                       (7, -6.9675052),
                       (8, -7.9377747),
                   ]
               ),
           ),
       )

The error message is pasted below. Can someone help me debug this? I ran a pgfplot example successfully and installed the required software as per the instructions
Thank you!

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/esM5q/src/backends/pgfplotsx.jl:769

[6] **(::Plots.PGFPlotsXPlot)(**plt::Plots.Plot{Plots.PGFPlotsXBackend}**)**

@ Plots ~/.julia/packages/Plots/esM5q/src/backends/pgfplotsx.jl:141

[7] **_update_plot_object(**plt::Plots.Plot{Plots.PGFPlotsXBackend}**)**

@ Plots ~/.julia/packages/Plots/esM5q/src/backends/pgfplotsx.jl:1359

[8] **prepare_output(**plt::Plots.Plot{Plots.PGFPlotsXBackend}**)**

@ Plots ~/.julia/packages/Plots/esM5q/src/plot.jl:257

[9] **display(**#unused#::Plots.PlotsDisplay, plt::Plots.Plot{Plots.PGFPlotsXBackend}**)**

@ Plots ~/.julia/packages/Plots/esM5q/src/output.jl:168

[10] **display(**x::Any**)**

@ Base.Multimedia ./multimedia.jl:340

[11] **#invokelatest#2**

@ ./essentials.jl:816 [inlined]

[12] **invokelatest**

@ ./essentials.jl:813 [inlined]

[13] **print_response(**errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay}**)**

@ REPL /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/REPL.jl:305

[14] **(::REPL.var"#57#58"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(**io::Any**)**

@ REPL /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/REPL.jl:287

[15] **with_repl_linfo(**f::Any, repl::REPL.LineEditREPL**)**

@ REPL /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/REPL.jl:557

[16] **print_response(**repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool**)**

@ REPL /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/REPL.jl:285

[17] **(::REPL.var"#do_respond#80"{Bool, Bool, REPL.var"#93#103"{REPL.LineEditREPL, REPL.REPLHistoryProvider}, REPL.LineEditREPL, REPL.LineEdit.Prompt})(**s::REPL.LineEdit.MIState, buf::Any, ok::Bool**)**

@ REPL /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/REPL.jl:899

[18] **#invokelatest#2**

@ ./essentials.jl:816 [inlined]

[19] **invokelatest**

@ ./essentials.jl:813 [inlined]

[20] **run_interface(**terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState**)**

@ REPL.LineEdit /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/LineEdit.jl:2647

[21] **run_frontend(**repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef**)**

@ REPL /Applications/Julia-1.9.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/REPL.jl:1300

[22] **(::REPL.var"#62#68"{REPL.LineEditREPL, REPL.REPLBackendRef})()**

@ REPL ./task.jl:514

Can confirm. I encountered the same error message when I was trying to create a TikZ figure using the Plots package. OP’s first MWE also raises this error on my machine.

Setup: Julia 1.9.0 (2023-05-07) with PGFPlotsX v1.6.0 and Plots v1.38.11 on Fedora (Linux x86_64)

Edit: After installing the additional package PGFPlots (v3.4.2), the issue has been resolved for me. The MWE works properly now.

This is fixed on master and will be released today. See Key normalization broke Plots backend · Issue #317 · KristofferC/PGFPlotsX.jl · GitHub for reference.

Thank you! I ran Pkg.update() and then ran my MWE again and it worked well. Beautiful plots! What a wonderful technology!