KristofferC / PGFPlotsX.jl

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

ticklabes are not working through Plots.jl with a :log scale #298

Closed IljaK91 closed 1 year ago

IljaK91 commented 2 years ago
using Plots
pgfplotsx()
plot(1:10, 1:10, yaxis = :log)
yticks!(1:10, ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])
# This throws an error
gr()
plot(1:10, 1:10, yaxis = :log)
yticks!(1:10, ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"])
# This works

With the error message

Display Error: ERROR: BoundsError: attempt to access 1-element Vector{SubString{String}} at index [2]
Stacktrace:
  [1] getindex
    @ .\array.jl:861 [inlined]
  [2] indexed_iterate
    @ .\tuple.jl:90 [inlined]
  [3] wrap_power_labels(ticks::Vector{String})
    @ Plots C:\Users\kantorov\.julia\packages\Plots\E2187\src\backends\pgfplotsx.jl:1236
  [4] pgfx_axis!(opt::PGFPlotsX.Options, sp::Plots.Subplot{Plots.PGFPlotsXBackend}, letter::Symbol)
    @ Plots C:\Users\kantorov\.julia\packages\Plots\E2187\src\backends\pgfplotsx.jl:1348
  [5] (::Plots.PGFPlotsXPlot)(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots C:\Users\kantorov\.julia\packages\Plots\E2187\src\backends\pgfplotsx.jl:167
  [6] _update_plot_object(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots C:\Users\kantorov\.julia\packages\Plots\E2187\src\backends\pgfplotsx.jl:1478
  [7] prepare_output(plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots C:\Users\kantorov\.julia\packages\Plots\E2187\src\plot.jl:247
  [8] show(io::Base64.Base64EncodePipe, m::MIME{Symbol("image/png")}, plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots C:\Users\kantorov\.julia\packages\Plots\E2187\src\output.jl:201
  [9] base64encode(::Function, ::MIME{Symbol("image/png")}, ::Vararg{Any}; context::Nothing)
    @ Base64 C:\Users\kantorov\.julia\juliaup\julia-1.7.3+0~x64\share\julia\stdlib\v1.7\Base64\src\encode.jl:209
 [10] _binstringmime
    @ C:\Users\kantorov\.julia\juliaup\julia-1.7.3+0~x64\share\julia\stdlib\v1.7\Base64\src\Base64.jl:46 [inlined]
 [11] stringmime(m::MIME{Symbol("image/png")}, x::Plots.Plot{Plots.PGFPlotsXBackend}; context::Nothing)
    @ Base64 C:\Users\kantorov\.julia\juliaup\julia-1.7.3+0~x64\share\julia\stdlib\v1.7\Base64\src\Base64.jl:43
 [12] stringmime
    @ C:\Users\kantorov\.julia\juliaup\julia-1.7.3+0~x64\share\julia\stdlib\v1.7\Base64\src\Base64.jl:43 [inlined]
 [13] display(d::VSCodeServer.InlineDisplay, m::MIME{Symbol("image/png")}, x::Plots.Plot{Plots.PGFPlotsXBackend})
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\display.jl:57
 [14] display(d::VSCodeServer.InlineDisplay, mime::String, x::Any)
    @ Base.Multimedia .\multimedia.jl:216
 [15] display(d::VSCodeServer.InlineDisplay, x::Plots.Plot{Plots.PGFPlotsXBackend})
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\display.jl:165
 [16] #invokelatest#2
    @ .\essentials.jl:716 [inlined]
 [17] invokelatest
    @ .\essentials.jl:714 [inlined]
 [18] (::VSCodeServer.var"#65#69"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:184
 [19] withpath(f::VSCodeServer.var"#65#69"{Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams}, path::String)
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\repl.jl:184
 [20] (::VSCodeServer.var"#64#68"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:153
 [21] hideprompt(f::VSCodeServer.var"#64#68"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\repl.jl:36
 [22] (::VSCodeServer.var"#63#67"{Bool, Bool, Bool, Module, String, Int64, Int64, String, VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:124
 [23] with_logstate(f::Function, logstate::Any)
    @ Base.CoreLogging .\logging.jl:511
 [24] with_logger
    @ .\logging.jl:623 [inlined]
 [25] (::VSCodeServer.var"#62#66"{VSCodeServer.ReplRunCodeRequestParams})()
    @ VSCodeServer c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:201
 [26] #invokelatest#2
    @ .\essentials.jl:716 [inlined]
 [27] invokelatest(::Any)
    @ Base .\essentials.jl:714
 [28] macro expansion
    @ c:\Users\kantorov\.vscode\extensions\julialang.language-julia-1.6.24\scripts\packages\VSCodeServer\src\eval.jl:34 [inlined]
 [29] (::VSCodeServer.var"#60#61")()
    @ VSCodeServer .\task.jl:429
status Plots PGFPlotsX GR
      Status `C:\Users\kantorov\.julia\environments\v1.7\Project.toml`
  [28b8d3ca] GR v0.64.4
  [8314cec4] PGFPlotsX v1.5.0
  [91a5bcdd] Plots v1.31.1
t-bltg commented 1 year ago

This should be reported to Plots.jl as this appears to be a Plots bug.