This has come up before with @jheinen talking about how to improve animations made from GR, you should really be using the animation functions from GR. Now, we see from @SimonDanisch the following
One such use case is animations with Plots.jl, which is quite slow right now. For every frame it completely tears down GLVisualize’s state and rebuilds it, which is not what I’ve optimized for yet. So even though that GLVisualize might offer the fastest animation speeds of all backends, animations done with Plots.jl can be slow due to this bad interaction.
It seems the fastest libraries have built-in tools for solving a lot of problems with animations, but Plots.jl isn't able to make good use of them. This probably would be quite a bit of work to implement, but would have some very nice outcomes for Plots.jl users.
The existing animation interface was intended to be something that "just works" whenever a backend can output PNG. I agree it should be improved/redesigned to accommodate better ways to save movies/animations. Anyone that has the knowledge/time to do this, please step up.
Well, @tbreloff and I might have found a simple solution to this problem for GLVisualize ;)
Wait... we did?
On Mon, Nov 21, 2016 at 4:13 PM Simon [email protected] wrote:
Well, @tbreloff https://github.com/tbreloff and I might have found a
simple solution to this problem for GLVisualize ;)—
You are receiving this because you were mentioned.Reply to this email directly, view it on GitHub
https://github.com/tbreloff/Plots.jl/issues/580#issuecomment-262068808,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AA492qdk649XYrpbvwwJzTAOtSIAd1FTks5rAgllgaJpZM4K4YFh
.
The caching of RenderObjects stuff?
I was just wondering whether caching of RenderObjects was ever implemented? It would be awesome to have faster animations. Or is there another recommended way to update a line plot quickly? I have in mind creating something like an oscilloscope display.
@Cody-G: What about this?
# Plot a real-time spectrogram
# see https://github.com/JuliaAudio/PortAudio.jl
using GR, PortAudio, SampledSignals
const N = 1024
const stream = PortAudioStream(1, 0, blocksize=N)
const buf = read(stream, N)
const fmin = 0Hz
const fmax = 10000Hz
const fs = Float32[float(f) for f in domain(fft(buf)[fmin..fmax])]
while true
read!(stream, buf)
plot(fs, abs.(fft(buf)[fmin..fmax]), xlim=(fs[1],fs[end]), ylim=(0,100))
end
... also works with Plots + gr:
using Plots, PortAudio, SampledSignals
gr(show=true)
...
@jheinen that is fast, thanks! I replaced the data points with a random vector and plotted it over and over to measure speed. On my laptop I got 65 fps by using GR directly. That dropped to 49 fps when using Plots -- still quite good! Does GR have an interface for streaming data point-by-point? I quickly looked through the API reference but didn't see anything there.
Also, I think I'm running into https://github.com/jheinen/GR.jl/issues/20 and it's kind of a bummer for what I'm doing. I have to restart Julia in order to plot again after closing the window. Is there a workaround?
I'm using Windows for this project (in case it matters). Thanks!
Most helpful comment
Wait... we did?
On Mon, Nov 21, 2016 at 4:13 PM Simon [email protected] wrote: