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

조회 수: 3 (최근 30일)
Johannes Köbele
Johannes Köbele 2020년 8월 9일
답변: Alan Moses 2020년 8월 12일
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