Reputation: 73
I am life plotting a dataset for creating hysteresis loops. I agreed with the plot speed before but since I added the scatter it got really slow.
The scatter adds a marker to the current plotted datapoint so that if the plot overwrites you can still pursuite the animated line.
Here is my code:
hAL = animatedline; % line handle
hAL.LineStyle='-';
hAL.Color='blue';
% defaults for the marker
hAx=gca; % get the axis handle
sz=10; % size of marker
clr='b'; % color
hS=scatter(hAx,nan,nan,sz,clr); % initial point won't show but creates handle
x = mmatrix(:,2);
y = mmatrix(:,1);
for k = 1:length(x)
addpoints(hAL,x(k),y(k));
set(hS,'xdata',x(k),'ydata',y(k)) % update the marker position
drawnow
end
Do you know of an option to regulate the plot speed?
I tried drawnow limitrate
but it's to fast.
Regards jw
Upvotes: 0
Views: 1507