how to plot the number of each run/plot in a scatterplot

3 次查看(过去 30 天)
tried to realize the problem by using annotations, but the programm overwrites and keeps the number of the loop-variable zas in the plot. This produces a "black numberball". Is it possible to delete the privious number?
figure(1)
v = VideoWriter('testvideo1.avi');
open(v);
for zas=1:Schritte
plot([untere_Grenze untere_Grenze],[ Grenze untere_Grenze], 'black'); % Gerade
title('Stickstoffgenerator')
hold on
plot([Grenze untere_Grenze],[untere_Grenze untere_Grenze], 'black'); % Gerade
hold on
plot([Grenze Grenze],[Grenze untere_Grenze], 'black');
hold on
plot([untere_Grenze Grenze],[Grenze Grenze], 'black');
hold on
plot([0 0],[untere_Grenze Grenze], 'magenta'); % Membran
hold on
txt={'N2 sind um den Faktor X und O2 sind um den Faktor Y vergrößert'};
text(1.3,1.5, 'Stickstoff', 'HorizontalAlignment','left', 'Color', 'r')
text(1.3,1.7, 'Sauerstoff', 'HorizontalAlignment','left', 'Color', 'b')
a=annotation('textbox',[.6 .8 .7 .2],'String',txt,'EdgeColor','none');
numbzas=annotation('textbox',[.1 .8 .7 .2],'String',zas,'EdgeColor','none'); % used annotation !!!
a.FontSize=5.4;
for zp=1:2:(2*Anzahl_mol)
xlim([untere_Grenze+3/10*untere_Grenze Grenze+3/10*Grenze])
ylim([untere_Grenze+3/10*untere_Grenze Grenze+3/10*Grenze])
scatter(Vector_Lage(zp,zas),Vector_Lage(zp+1,zas),350*R,'filled','red')%,'markerfacecolor','red')
hold on
end
for zp=(2*Anzahl_mol)+1:2:(2*Gesamt_Mol)
xlim([untere_Grenze+3/10*untere_Grenze Grenze+3/10*Grenze])
ylim([untere_Grenze+3/10*untere_Grenze Grenze+3/10*Grenze])
scatter(Vector_Lage(zp,zas),Vector_Lage(zp+1,zas),200*R2,'filled', 'blue')%,'markerfacecolor','red')
hold on
end
pause(.005)
frame =getframe(gcf);
writeVideo(v,frame);
hold off
end
close(v);
  2 个评论
Image Analyst
Image Analyst 2020-8-9
It's hard to visualize what's going on without the video. Please attach a short video in a zip file.
Johannes Köbele
Johannes Köbele 2020-8-9
The mentioned "black numberball" is in the top left corner. I hope you can open the file and thanks a lot!

请先登录,再进行评论。

回答(1 个)

Alan Moses
Alan Moses 2020-8-12
Hi,
Yes, it is possible to modify the number of each run. Initialize the annotation outside the loop and change the text inside the loop. Please try the following method:
txt = '';
numbzas=annotation('textbox',[.1 .8 .7 .2],'String',txt,'EdgeColor','none')
for zas=1:Schritte
txt = sprintf('Run number: %d ',zas);
set(numbzas,'String',txt)
end
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by