# Pgfplotsx TypeError after fresh install

**URL:** <https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596>\
**Category:** New to Julia\
**Tags:** plotting, pgfplotsx\
**Created:** [April 5, 2021, 7:35am UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596 "2021-04-05T07:35:05Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![OlafTeichert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olafteichert/32/18546_2.png) [@OlafTeichert](https://discourse.julialang.org/u/OlafTeichert)\
**Post date:** [April 5, 2021, 7:35am UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/1 "2021-04-05T07:35:05Z")

</div>

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

Here is a minimum reproducible example:

```julia
using Plots
pgfplotsx()
plot([1,2,3,4,5])

```

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?

---

<div class="post-metadata">

**Author:** ![nilshg](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nilshg/32/2283_2.png) [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Post date:** [April 5, 2021, 8:23am UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/2 "2021-04-05T08:23:25Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OlafTeichert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olafteichert/32/18546_2.png) [@OlafTeichert](https://discourse.julialang.org/u/OlafTeichert)\
**Post date:** [April 5, 2021, 12:45pm UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/3 "2021-04-05T12:45:04Z")

</div>

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  
WORD\_SIZE: 64  
LIBM: libopenlibm  
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)  
Environment:  
JULIA\_EDITOR = “C:\Users\olaf\_\AppData\Local\atom\app-1.55.0\atom.exe” -a  
JULIA\_NUM\_THREADS = 4

---

<div class="post-metadata">

**Author:** ![Mustafa\_Al\_Shaqaq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mustafa_al_shaqaq/32/24302_2.png) [@Mustafa\_Al\_Shaqaq](https://discourse.julialang.org/u/Mustafa_Al_Shaqaq)\
**Post date:** [April 23, 2021, 3:23am UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/4 "2021-04-23T03:23:05Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [April 23, 2021, 6:04am UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/5 "2021-04-23T06:04:41Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mustafa\_Al\_Shaqaq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mustafa_al_shaqaq/32/24302_2.png) [@Mustafa\_Al\_Shaqaq](https://discourse.julialang.org/u/Mustafa_Al_Shaqaq)\
**Post date:** [April 23, 2021, 6:33pm UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/6 "2021-04-23T18:33:08Z")

</div>

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

Scirpt:

using Plots  
using LaTeXStrings  
using Statistics  
using ColorSchemes  
using TikzPictures  
pgfplotsx()

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(PGFPlotsX.save), ::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

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [April 23, 2021, 7:21pm UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/7 "2021-04-23T19:21:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![OlafTeichert](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olafteichert/32/18546_2.png) [@OlafTeichert](https://discourse.julialang.org/u/OlafTeichert)\
**Post date:** [April 29, 2021, 8:55am UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/8 "2021-04-29T08:55:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mustafa\_Al\_Shaqaq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mustafa_al_shaqaq/32/24302_2.png) [@Mustafa\_Al\_Shaqaq](https://discourse.julialang.org/u/Mustafa_Al_Shaqaq)\
**Post date:** [May 14, 2021, 9:04pm UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/9 "2021-05-14T21:04:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [August 11, 2021, 3:50pm UTC](https://discourse.julialang.org/t/pgfplotsx-typeerror-after-fresh-install/58596/10 "2021-08-11T15:50:16Z")

</div>

This is fixed now.
