How to fix "! Dimension too large." when using pgfplotsx?

homocomputeris
Sun, 09 Mar 2025 12:50:56 +0000
Visualization

When trying to plot the following data

VectorOfArray{Float64,2}:
2-element Vector{Vector{Float64}}:
 [0.00969160836699929, 516.6666666666663]
 [0.00974104323961814, 900.0]
VectorOfArray{Float64,2}:
2-element Vector{Vector{Float64}}:
 [0.009691608366954797, 650.0]
 [0.00974104323957102, 650.0]
VectorOfArray{Float64,2}:
2-element Vector{Vector{Float64}}:
 [0.009691608367069041, 1966.6666666666654]
 [0.00974104323959538, 1966.6666666666654]
VectorOfArray{Float64,2}:
2-element Vector{Vector{Float64}}:
 [0.009691608366954797, 650.0]
 [0.00974104323957102, 650.0]

with

scatter!(fig, data[2, :], data[1, :],
    markershape = markers[k], markercolor = colors[k], markersize = 6)
display(fig)
savefig(fig, "fig.pdf")

I get

! Dimension too large.
<recently read> \pgf@yy

l.119 \end{axis}

ERROR: The latex command `lualatex jl_KB8t2vSnWV.tex` failed
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:35
  [2] savepdf(filename::String, td::PGFPlotsX.TikzDocument; latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{…}, run_count::Int64, tmp::String)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/XcmEC/src/tikzdocument.jl:202
  [3] savepdf
    @ ~/.julia/packages/PGFPlotsX/XcmEC/src/tikzdocument.jl:159 [inlined]
  [4] savesvg(filename::String, td::PGFPlotsX.TikzDocument; latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{…}, keep_pdf::Bool)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/XcmEC/src/tikzdocument.jl:272
  [5] savesvg
    @ ~/.julia/packages/PGFPlotsX/XcmEC/src/tikzdocument.jl:267 [inlined]
  [6] save(filename::String, td::PGFPlotsX.TikzDocument; include_preamble::Bool, latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Vector{…}, dpi::Int64, showing_ide::Bool)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/XcmEC/src/tikzdocument.jl:84
  [7] show(f::IOBuffer, ::MIME{Symbol("image/svg+xml")}, td::PGFPlotsX.TikzDocument)
    @ PGFPlotsX ~/.julia/packages/PGFPlotsX/XcmEC/src/tikzdocument.jl:294
  [8] _show(io::IOBuffer, mime::MIME{Symbol("image/svg+xml")}, plt::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Plots ~/.julia/packages/Plots/Ec1L1/src/backends/pgfplotsx.jl:1371
  [9] #invokelatest#2
    @ ./essentials.jl:1055 [inlined]
 [10] invokelatest
    @ ./essentials.jl:1052 [inlined]
 [11] show
    @ ~/.julia/packages/Plots/Ec1L1/src/output.jl:232 [inlined]
 [12] __binrepr(m::MIME{Symbol("image/svg+xml")}, x::Plots.Plot{Plots.PGFPlotsXBackend}, context::Nothing)
    @ Base.Multimedia ./multimedia.jl:171
 [13] _textrepr
    @ ./multimedia.jl:163 [inlined]
 [14] stringmime(m::MIME{Symbol("image/svg+xml")}, x::Plots.Plot{Plots.PGFPlotsXBackend})
    @ Base64 ~/.julia/juliaup/julia-1.11.3+0.x64.apple.darwin14/share/julia/stdlib/v1.11/Base64/src/Base64.jl:44
 [15] display(d::VSCodeServer.InlineDisplay, m::MIME{Symbol("image/svg+xml")}, x::Any)
    @ VSCodeServer ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/VSCodeServer/src/display.jl:68
 [16] display(d::VSCodeServer.InlineDisplay, mime::String, x::Any)
    @ Base.Multimedia ./multimedia.jl:228
 [17] display(d::VSCodeServer.InlineDisplay, x::Any)
    @ VSCodeServer ~/.cursor/extensions/julialang.language-julia-1.127.2/scripts/packages/VSCodeServer/src/display.jl:207
 [18] display(x::Any)
    @ Base.Multimedia ./multimedia.jl:340
 [19] top-level scope
    @ ~/example.jl:159
Some type information was truncated. Use `show(err)` to see complete types.

What exactly does it mean, and how can I fix this error?

2 posts - 2 participants