How to repeat eficiently part of plot for succesive plots in PyPlot or Matplotlib?

Viewed 42

I am making a succesion of plots for an animation that consists of a colormap that changes and has a diagram of a neuron over it that is static. The heatmap is very easy to plot for the computer, and is fast, but the diagram of the neuron is quite laborious ( some 4000 data points ) and takes a lot of to repeat it for every frame. So I thought, can it be possible to only redraw the heatmap?

I am using PyPlot through Julia, so my code looks like this:

for t=1:801
    f=figure(figsize=(4,3))
    imshow(lfp3[t,:,:], extent=[-700,700,-400,1200], origin="lower")
    for l in cel2
        plot(l[:,1], l[:,2], marker="None", linewidth=1)
    end
    nstring=lpad(t, 4, "0")
    nom="tubuela-$nstring"*".png"
    savefig(nom,dpi=72)
    close()
    if mod(t,50)==0
        println("listos $t")
    end
end
0 Answers
Related