JuliaGraphics / Immerse.jl

Dive deeper into your data with interactive graphics
Other
89 stars 13 forks source link

Fast Drawing #68

Closed AStupidBear closed 8 years ago

AStupidBear commented 8 years ago

Maybe this should not be a issue on Immerse. Just ask for help.

I want to make a real-time annimation like this

using Immerse,Gtk.ShortNames
w = @Window("hi",1000,400) |> (c = @Canvas())
showall(w)
p = plot(y=[rand()], Geom.line, Coord.cartesian(xmin=1, xmax=10000, ymin=0, ymax=1))
display(c,Figure(p))
for i=1:10000
    push!(p.layers[1].mapping[:y],rand())
    display(c,Figure(p))
    sleep(0.0001)
end

At every time step, I have to use display(c,Figure(p)) to redraw the plot. When the number of points become large (>10000), the drawing process is slow. Is there a smart way to preserve the previous drawing on the canvas?

timholy commented 8 years ago

I don't think so. Immerse is a layer on top of Gadfly, and Gadfly isn't the best for performance, I'm afraid. You might be happier with something like GLVisualize for performance-sensitive operations.

AStupidBear commented 8 years ago

Thank you.