Saving figures no longer possible after Plots update

Hi, hopefully this is a quick fix, I couldn’t find anything related.
I updated all installed packages using Pkg.update() this morning.
Since then the following lines give an error:

julia> a = ones(3)
3-element Array{Float64,1}:
 1.0
 1.0
 1.0

julia> using Plots

julia> pyplot()
Plots.PyPlotBackend()

julia> p1 = scatter(a)

julia> savefig(p1, "test.pdf")
ERROR: BoundsError: attempt to access ""
  at index [1]
Stacktrace:
 [1] nextind(::String, ::Int64, ::Int64) at ./strings/basic.jl:520
 [2] #chop#327(::Int64, ::Int64, ::Function, ::String) at ./strings/util.jl:99
 [3] #chop at ./none:0 [inlined]
 [4] addExtension(::String, ::String) at /home/moritz/.julia/packages/Plots/vAz7I/src/output.jl:96
 [5] pdf(::Plots.Plot{Plots.PyPlotBackend}, ::String) at /home/moritz/.julia/packages/Plots/vAz7I/src/output.jl:21
 [6] savefig(::Plots.Plot{Plots.PyPlotBackend}, ::String) at /home/moritz/.julia/packages/Plots/vAz7I/src/output.jl:124
 [7] top-level scope at none:0

Saving the figure from the pyplot gui is no problem. Different backends give the same error.
The updated packages were:

julia> Pkg.update()
  Updating registry at `~/.julia/registries/General`
  Updating git-repo `https://github.com/JuliaRegistries/General.git`
  Updating git-repo `https://github.com/tonyhffong/Lint.jl`
 Resolving package versions...
 Installed PyPlot ─────────── v2.9.0
 Installed Juno ───────────── v0.8.2
 Installed TensorOperations ─ v2.2.0
 Installed Atom ───────────── v0.12.11
 Installed StatsBase ──────── v0.33.0
 Installed Plots ──────────── v1.3.5
 Installed TensorCast ─────── v0.3.0
 Installed Parameters ─────── v0.12.1
 Installed PlotThemes ─────── v2.0.0
 Installed FuzzyCompletions ─ v0.1.0
 Installed LazyStack ──────── v0.0.7
 Installed JuliaInterpreter ─ v0.7.16
 Installed Colors ─────────── v0.12.1
 Installed FillArrays ─────── v0.8.10
 Installed BinaryProvider ─── v0.5.10
 Installed JuliaFormatter ─── v0.5.5
 Installed PlotUtils ──────── v1.0.4
 Installed RecipesBase ────── v1.0.1
 Installed DataStructures ─── v0.17.17
 Installed CMakeWrapper ───── v0.2.4
 Installed StatsFuns ──────── v0.9.5
 Installed Optim ──────────── v0.18.1
 Installed DiffEqDiffTools ── v0.14.0
 Installed Distributions ──── v0.23.3
 Installed LLVM ───────────── v1.5.1
 Installed HTTP ───────────── v0.8.15
 Installed UnPack ─────────── v1.0.1
 Installed ColorSchemes ───── v3.9.0
 Installed Interpolations ─── v0.12.10
 Installed GR ─────────────── v0.49.1
  Updating `~/.julia/environments/v1.1/Project.toml`
  [c52e3926] ↑ Atom v0.12.8 ⇒ v0.12.11
  [28b8d3ca] ↑ GR v0.47.0 ⇒ v0.49.1
  [e5e0dc1b] ↑ Juno v0.8.1 ⇒ v0.8.2
  [d96e819e] ↑ Parameters v0.12.0 ⇒ v0.12.1
  [91a5bcdd] ↑ Plots v0.29.5 ⇒ v1.3.5
  [d330b81b] ↑ PyPlot v2.8.2 ⇒ v2.9.0
  [2913bbd2] ↑ StatsBase v0.32.2 ⇒ v0.33.0
  [02d47bb6] ↑ TensorCast v0.2.1 ⇒ v0.3.0
  [6aa20fa7] ↑ TensorOperations v2.1.4 ⇒ v2.2.0
  Updating `~/.julia/environments/v1.1/Manifest.toml`
  [4fba245c] - ArrayInterface v2.2.0
  [4c555306] - ArrayLayouts v0.1.5
  [c52e3926] ↑ Atom v0.12.8 ⇒ v0.12.11
  [b99e7846] ↑ BinaryProvider v0.5.9 ⇒ v0.5.10
  [d5fb7624] ↑ CMakeWrapper v0.2.3 ⇒ v0.2.4
  [7057c7e9] - Cassette v0.3.3
  [35d6a980] + ColorSchemes v3.9.0
  [5ae59095] ↑ Colors v0.12.0 ⇒ v0.12.1
  [864edb3b] ↑ DataStructures v0.17.15 ⇒ v0.17.17
  [01453d9d] ↓ DiffEqDiffTools v1.6.0 ⇒ v0.14.0
  [31c24e10] ↑ Distributions v0.23.2 ⇒ v0.23.3
  [1a297f60] ↑ FillArrays v0.8.9 ⇒ v0.8.10
  [fb4132e2] + FuzzyCompletions v0.1.0
  [28b8d3ca] ↑ GR v0.47.0 ⇒ v0.49.1
  [cd3eb016] ↑ HTTP v0.8.14 ⇒ v0.8.15
  [a98d9a8b] ↑ Interpolations v0.12.9 ⇒ v0.12.10
  [98e50ef6] ↑ JuliaFormatter v0.3.9 ⇒ v0.5.5
  [aa1ae85d] ↑ JuliaInterpreter v0.7.15 ⇒ v0.7.16
  [e5e0dc1b] ↑ Juno v0.8.1 ⇒ v0.8.2
  [929cbde3] ↑ LLVM v1.4.1 ⇒ v1.5.1
  [5078a376] - LazyArrays v0.14.11
  [1fad7336] ↑ LazyStack v0.0.5 ⇒ v0.0.7
  [429524aa] ↓ Optim v0.20.1 ⇒ v0.18.1
  [d96e819e] ↑ Parameters v0.12.0 ⇒ v0.12.1
  [ccf2f8ad] ↑ PlotThemes v1.0.3 ⇒ v2.0.0
  [995b91a9] ↑ PlotUtils v0.6.5 ⇒ v1.0.4
  [91a5bcdd] ↑ Plots v0.29.5 ⇒ v1.3.5
  [d330b81b] ↑ PyPlot v2.8.2 ⇒ v2.9.0
  [3cdcf5f2] ↑ RecipesBase v0.8.0 ⇒ v1.0.1
  [2913bbd2] ↑ StatsBase v0.32.2 ⇒ v0.33.0
  [4c63d2b9] ↑ StatsFuns v0.9.4 ⇒ v0.9.5
  [02d47bb6] ↑ TensorCast v0.2.1 ⇒ v0.3.0
  [6aa20fa7] ↑ TensorOperations v2.1.4 ⇒ v2.2.0
  [37b6cedf] - Traceur v0.3.0
  [3a884ed6] + UnPack v1.0.1
  Building GR ───→ `~/.julia/packages/GR/cRdXQ/deps/build.log`
  Building Plots → `~/.julia/packages/Plots/vAz7I/deps/build.log`

Especially PyPlot and Plots were updated:

  [91a5bcdd] ↑ Plots v0.29.5 ⇒ v1.3.5
  [d330b81b] ↑ PyPlot v2.8.2 ⇒ v2.9.0

Any Help is appreciated!

I can reproduce this on Julia v1.1, but its not happening on Julia v1.4.2.
The quick fix would be to update Julia.

1 Like

The culprit is, that chop("", head =1, tail=0) errors on julia 1.1

It also works on Julia 1.0.5

Thanks! Updated to Julia 1.4.2 from 1.1 and it works!