Pgfplotsx TypeError after fresh install

I just reinstalled Julia on a new laptop and am getting an error when using the pgfsplotsx backend.

Here is a minimum reproducible example:

using Plots

Resulting in the following error message:

TypeError: in keyword argument dpi, expected Int64, got a value of type Float64

Any ideas what might cause this or how to fix it?

I’m not a PGFPlots user, but one thing you can try is plot([1,2,3,4,5], dpi = 100) (or whatever value)?

Thanks for the quick reply. Unfortunately, that doesn’t work. I’m wondering if there’s something wrong with my installation, but I don’t know how to resolve it. I just reinstalled the entire julia distribution, but the error persists. For what it’s worth, here’s the version info:

Julia Version 1.6.0
Commit f9720dc2eb (2021-03-24 12:55 UTC)
Platform Info:
OS: Windows (x86_64-w64-mingw32)
CPU: Intel(R) Core™ i7-8550U CPU @ 1.80GHz
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
JULIA_EDITOR = “C:\Users\olaf_\AppData\Local\atom\app-1.55.0\atom.exe” -a

1 Like

I am having the same problem. Were you able to solve this?

I can not reproduce. What version of Plots and PGFPlotsX do you have installed. Also when reporting an error like this, it is useful to include the stacktrace.

1 Like

I am using Version 1.5.4 (2021-03-11)


using Plots
using LaTeXStrings
using Statistics
using ColorSchemes
using TikzPictures

f(x, y) = exp(-x^2-y^2)
xs = range(-1,1, length=20)
ys = range(-1, 1, length = 20)
h1=heatmap(xs, ys, [f(x,y) for x in xs, y in ys])
xlabel!(“X Axis”)
ylabel!(“Y Axis”)

The error I got:

TypeError: in keyword argument dpi, expected Int64, got a value of type Float64

(::PGFPlotsX.var"#savepng##kw")(::NamedTuple{(:latex_engine, :buildflags, :dpi),Tuple{PGFPlotsX.LaTeXEngine,Array{String,1},Float64}}, ::typeof(PGFPlotsX.savepng), ::String, ::PGFPlotsX.TikzDocument) at tikzdocument.jl:311

save(::String, ::PGFPlotsX.TikzDocument; include_preamble::Bool, latex_engine::PGFPlotsX.LaTeXEngine, buildflags::Array{String,1}, dpi::Float64, showing_ide::Bool) at tikzdocument.jl:88

(::PGFPlotsX.var"#save##kw")(::NamedTuple{(:dpi,),Tuple{Float64}}, ::typeof(, ::String, ::PGFPlotsX.TikzDocument) at tikzdocument.jl:73

_show(::IOContext{Base64.Base64EncodePipe}, ::MIME{Symbol(“image/png”)}, ::Plots.Plot{Plots.PGFPlotsXBackend}) at pgfplotsx.jl:1402

_showjuno at output.jl:273 [inlined]

showjuno(::IOContext{Base64.Base64EncodePipe}, ::MIME{Symbol(“image/png”)}, ::Plots.Plot{Plots.PGFPlotsXBackend}) at output.jl:257

show(::IOContext{Base64.Base64EncodePipe}, ::MIME{Symbol(“image/png”)}, ::Plots.Plot{Plots.PGFPlotsXBackend}) at output.jl:212

base64encode(::Function, ::MIME{Symbol(“image/png”)}, ::Vararg{Any,N} where N; context::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at encode.jl:208

base64encode at encode.jl:203 [inlined]

_binstringmime at Base64.jl:46 [inlined]

stringmime(::MIME{Symbol(“image/png”)}, ::Plots.Plot{Plots.PGFPlotsXBackend}; context::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at Base64.jl:43

(::Base64.var"#stringmime##kw")(::NamedTuple{(:context,),Tuple{IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}}}, ::typeof(Base64.stringmime), ::MIME{Symbol(“image/png”)}, ::Plots.Plot{Plots.PGFPlotsXBackend}) at Base64.jl:43

stringmime(::String, ::Plots.Plot{Plots.PGFPlotsXBackend}; context::IOContext{Base.GenericIOBuffer{Array{UInt8,1}}}) at Base64.jl:44

stringmime at Base64.jl:44 [inlined]

displayinplotpane(::Plots.Plot{Plots.PGFPlotsXBackend}) at showdisplay.jl:84

displayandrender(::Plots.Plot{Plots.PGFPlotsXBackend}) at showdisplay.jl:131

(::Atom.var"#204#209"{String})() at eval.jl:138

#invokelatest#1 at essentials.jl:710 [inlined]

invokelatest at essentials.jl:709 [inlined]

macro expansion at dynamic.jl:24 [inlined]

eval(::String, ::Int64, ::String, ::String, ::Bool) at eval.jl:114

invokelatest(::Any, ::Any, ::Vararg{Any,N} where N; kwargs::Base.Iterators.Pairs{Union{},Union{},Tuple{},NamedTuple{(),Tuple{}}}) at essentials.jl:710

invokelatest(::Any, ::Any, ::Vararg{Any,N} where N) at essentials.jl:709

macro expansion at eval.jl:41 [inlined]

(::Atom.var"#184#185")() at task.jl:356

I see now that this is in Juno. There might be some issue there, I can look at that.


Thank you for the support!

I was able to resolve the problem by reverting back to Julia Version 1.0.5 (2019-09-09).

Not sure what caused it, but I’m assuming some dependencies between my Juno, Julia and PGFPlotsX installations were broken.

I was able to resolve this issue by using VSCode instead of juno. Julia 1.6

This is fixed now.