Does someone got stuck with "savefig" in Julia?

144 views Asked by At

I have a problem with savefig (inside PlotlyJS) that I can't know where it comes from. The code is simple, there are some scatters and a figure that show correctly:

using PlotlyJS

n_points = 250
x_vals = 1:n_points
example_data = rand(n_points)
constant_mean = 0.5

trace1 = scatter(; x=x_vals, y=fill(constant_mean, n_points), name="Mean χ = 0.5")
trace2 = scatter(; x=x_vals, y=example_data, name="Data χ = 0.5")

layout = Layout(; title="Simplified Example")
p = plot([trace1, trace2], layout)

But when I run

savefig(p, "Plots/net_comparative.png")

The REPL gets stuck. It saves something, but it is a broken file, which I interpret to mean that the process "did not complete". However, it can get stuck like this for days and never finishes. They are simple plots that my other computer saves normally. Has anyone ever encountered this problem?

Actualization: Recently, I've discovered that it works if I save it as a .html but not as a .png or .pdf.

System data:

julia> versioninfo()
Julia Version 1.9.1
Commit 147bdf428c (2023-06-07 08:27 UTC)
Platform Info:
  OS: Windows (x86_64-w64-mingw32)
  CPU: 16 × 12th Gen Intel(R) Core(TM) i7-12650H
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-14.0.6 (ORCJIT, alderlake)
  Threads: 1 on 16 virtual cores
Environment:
  JULIA_EDITOR = code
  JULIA_NUM_THREADS =


julia> Pkg.status()
Status `C:\Users\franc\.julia\environments\v1.9\Project.toml`
⌃ [35d6a980] ColorSchemes v3.22.0
⌃ [31c24e10] Distributions v0.25.98
  [a98d9a8b] Interpolations v0.14.7
  [caafb194] Kaleido v0.2.7
⌃ [429524aa] Optim v1.7.6
  [a03496cd] PlotlyBase v0.8.19 `https://github.com/sglyon/PlotlyBase.jl#master`
  [f0f68f2c] PlotlyJS v0.18.11
⌃ [c3e4b0f8] Pluto v0.19.27
  [2fc8631c] PlutoSliderServer v0.3.26
  [fcd29c91] QuantEcon v0.16.5
⌃ [f2b01f46] Roots v2.0.17
⌃ [2913bbd2] StatsBase v0.34.0
  [37e2e46d] LinearAlgebra
  [de0858da] Printf
  [9a3f8284] Random
Info Packages marked with ⌃ have new versions available and may be upgradable.
0

There are 0 answers