mcdougallab / matlabneuroninterface

Interface for connecting NEURON and MATLAB
BSD 3-Clause "New" or "Revised" License
5 stars 1 forks source link

plot(t,v) is much slower than plot(t.data(), v.data()) #78

Closed ramcdougal closed 10 months ago

edovanveen commented 11 months ago

Probably linked to #79

vijayiyer05 commented 10 months ago

Following up on our chat today, animatedline may be a useful tool.

Would require a bit of a paradigm shift (pre-creation of the objects, perhaps at Session initialization). Note that Visibility is one of the properties that can be 'animated'.

tkuenzmw commented 10 months ago

I also add my 2 cents about plot performance. High-level functions like plot and plot3 create a graphics object each time they are called and that is expensive. A cool trick to plot 3d-lines that can change color is to "abuse" the patch primitive.

This has good performance because only one object will be created by the patch function

t = linspace(0,2*pi,100);
x = cos(t);
y = sin(t);
z = t;
c = cos(t).^2;

colormap(hsv)
patch(x,y,z,c,'FaceColor','none','EdgeColor','interp')
colorbar
view(3)

If you need discontinous lines then append "nan" at the end of each segment.