How can I fix legend in an animate plot 2D?
12 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Giacomo Lucidi
am 20 Nov. 2016
Bearbeitet: Adeel Yousuf
am 28 Jan. 2020
figure(1)
for j = 1:length(t)
plot(x,u(:,j),x,v(j,:),x,LF(j,:))
pause(0.1)
end
I would see the legend also the animate is running. Not only at the end of this. Thanks all.
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Adeel Yousuf
am 28 Jan. 2020
Bearbeitet: Adeel Yousuf
am 28 Jan. 2020
Not specific to your query but related to it... if some reader wants to animate the legend with every data point, then following code works with a little modification to @KSSV code. (...can be repeated for multiple vectors & likewise legends):
x = linspace(-2*pi,2*pi);
y1 = sin(x);
for i = 1:20
plot(x,rand(1)*y1,'r');
legend("sin(" + num2str(x(i))+")");
pause(0.1);
drawnow;
end
0 Kommentare
Siehe auch
Kategorien
Mehr zu Animation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!