How do I make @progress and @animate play nice together?

I am creating some gifs using the @animate macro in Plots.jl that are time consuming to make. I would like to display the progress with Juno.@progress. Unfortunately, stacking the two doesn’t work directly, e.g.

using Juno, Plots
@progress @animate for ii = 1:3
    scatter([ii,],[ii,])
end
ERROR: LoadError: @progress requires a for loop (for i in irange, j in jrange, ...; <body> end) or array comprehension with assignment (x = [<body> for i in irange, j in jrange, ...])

and

@animate @progress for ii = 1:3
    scatter([ii,],[ii,])
end
ERROR: LoadError: @animate macro expects a for-block. got: macrocall

Any suggestions of how to proceed? Thanks.

1 Like

Late to the party but replying because I had a similar question. Here is my solution which is pretty much verbatim from GitHub - timholy/ProgressMeter.jl: Progress meter for long-running computations.

using ProgressMeter

n=10
p = Progress(n)

@animate for i in 1:n
   # do stuff
   next!(p)
end

3 Likes

Thanks!