KristofferC / PGFPlotsX.jl

Plots in Julia using the PGFPlots LaTeX package
Other
301 stars 40 forks source link

Issue when xticklabels has exponents #300

Closed tknopp closed 1 year ago

tknopp commented 1 year ago

I am not sure if this is a Plots issue or a PGFPlotsX issue.


julia> using Plots

julia> pgfplotsx()
Plots.PGFPlotsXBackend()

julia> p=plot((1:1000).^2,(1:1000).^2, xscale=:log10)
! Missing $ inserted.
<inserted text> 
$
l.1043 \end{axis}

Error showing value of type Plots.Plot{Plots.PGFPlotsXBackend}:
ERROR: The latex command `lualatex jl_GYXGOa.tex` failed
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] savepdf(filename::String, td::PGFPlotsX.TikzDocument; latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{String}, run_count::Int64, tmp::String)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/pUwhF/src/tikzdocument.jl:202
  [3] save(filename::String, td::PGFPlotsX.TikzDocument; include_preamble::Bool, latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{String}, dpi::Int64, showing_ide::Bool)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/pUwhF/src/tikzdocument.jl:86
  [4] save(filename::String, td::PGFPlotsX.TikzDocument)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/pUwhF/src/tikzdocument.jl:73
  [5] display(d::PGFPlotsX.PGFPlotsXDisplay, p::PGFPlotsX.TikzDocument)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/pUwhF/src/tikzdocument.jl:356
  [6] _display(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/0MO2T/src/backends/pgfplotsx.jl:1384
  [7] display(#unused#::Plots.PlotsDisplay, plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/0MO2T/src/output.jl:158
  [8] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:328
  [9] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [10] invokelatest
    @ ./essentials.jl:714 [inlined]
 [11] print_response(errio::IO, response::Any, show_value::Bool, have_color::Bool, specialdisplay::Union{Nothing, AbstractDisplay})
    @ REPL /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:293
 [12] (::REPL.var"#45#46"{REPL.LineEditREPL, Pair{Any, Bool}, Bool, Bool})(io::Any)
    @ REPL /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:277
 [13] with_repl_linfo(f::Any, repl::REPL.LineEditREPL)
    @ REPL /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:510
 [14] print_response(repl::REPL.AbstractREPL, response::Any, show_value::Bool, have_color::Bool)
    @ REPL /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:275
 [15] (::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 /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:846
 [16] #invokelatest#2
    @ ./essentials.jl:716 [inlined]
 [17] invokelatest
    @ ./essentials.jl:714 [inlined]
 [18] run_interface(terminal::REPL.Terminals.TextTerminal, m::REPL.LineEdit.ModalInterface, s::REPL.LineEdit.MIState)
    @ REPL.LineEdit /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/LineEdit.jl:2493
 [19] run_frontend(repl::REPL.LineEditREPL, backend::REPL.REPLBackendRef)
    @ REPL /opt/software/julia-1.7.2/share/julia/stdlib/v1.7/REPL/src/REPL.jl:1232
 [20] (::REPL.var"#49#54"{REPL.LineEditREPL, REPL.REPLBackendRef})()
    @ REPL ./task.jl:423

My versions are:

(@v1.7) pkg> st  --manifest Plots
      Status `~/.julia/environments/v1.7/Manifest.toml`
  [91a5bcdd] Plots v1.31.6

(@v1.7) pkg> st  --manifest PGFPlotsX
      Status `~/.julia/environments/v1.7/Manifest.toml`
  [8314cec4] PGFPlotsX v1.5.0

I have code that worked a month ago and now fails with this error.

tknopp commented 1 year ago

This actually is a Plots.jl issue. Closing this one and opened this one: https://github.com/JuliaPlots/Plots.jl/issues/4308