Displaying Plots and images from REPL

New to Julia. I want to use Julia using only a simple text editor and the Julia 1.6.0 REPL. My initial programming goal is to replicate in Julia some code I’d written in Mathematica (Wolfram Language) to display a graph, with the additional feature to popup a description when a node is clicked or an edge is clicked to document its meaning (this works in Mathematica when I have the full system installed, but doesn’t work with a Mathematica reader).

The first step was to just create simple graphs able to pop up the node or edge description.

Creating the graph with LightGraphs was easy, as was calling on gplot from the GraphPlot package, but REPL output the plain text version of the graph, not a display or image of the graph.

Next, I found example code for the Lorenz Attractor in the documentation for the Plots package. I used that code as is to see what Julia REPL would do. It didn’t go well.

The result was an “infinite” sequence of

read: Connection reset by peer
send: Broken pipe

When I was finally able to kill this process, the system indicated the generate GIFS were placed in a subdirectory deep under the /var directory on my MacOS system. These GIFS display correctly when opened under Safari.

I’ve attached a screenshot of REPL output.

The Lorenz Attractor code is

using Plots
# define the Lorenz attractor
Base.@kwdef mutable struct Lorenz
    dt::Float64 = 0.02
    σ::Float64 = 10
    ρ::Float64 = 28
    β::Float64 = 8/3
    x::Float64 = 1
    y::Float64 = 1
    z::Float64 = 1

function step!(l::Lorenz)
    dx = l.σ * (l.y - l.x);         l.x += l.dt * dx
    dy = l.x * (l.ρ - l.z) - l.y;   l.y += l.dt * dy
    dz = l.x * l.y - l.β * l.z;     l.z += l.dt * dz

attractor = Lorenz()

# initialize a 3D plot with 1 empty series
plt = plot3d(
    xlim = (-30, 30),
    ylim = (-30, 30),
    zlim = (0, 60),
    title = "Lorenz Attractor",
    marker = 2,

# build an animated gif by pushing new points to the plot, saving every 10th frame
@gif for i=1:1500
    push!(plt, attractor.x, attractor.y, attractor.z)
end every 10```

Please note that the sequence is not infinite. There are 150 (very) slow steps to wait for. Try increasing the step from 10 to every 100

*NB: the DifferentialEquations.jl package solves the Lorenz problem in ~1 ms using a normal laptop. It is the GIF generation that takes too long

I wasn’t as clear as I should have been. I only used this code (from someone else) which did some plotting to see if the code worked under Julia 1.6.0 REPL and displayed a nice GIF.

It didn’t work as expected and didn’t display a GIF directly from the REPL

So my question is what do I have to add to this code 1) to prevent the trigger error messages, and 2) have to GIF displayed on my screen from the REPL execution.

I have no intention of using the varied pretty interfaces such as Pluto, IJulia, Jupyter etc. I only want to focus of Julia itself, and not be waylaid into understanding these other application.

Sorry, correcting my response. For a proper real-time update of the plot window, it seems that avoiding the @gif generation macro works best:

for i=1:1500
    push!(plt, attractor.x, attractor.y, attractor.z)

The above provides the nicest visualization.
Regarding the animated GIF created in your example, do not know what is the appropriate Julia image viewing package for displaying it. VS Code does it.