plot loop in a legend
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
INGRUS
am 7 Dez. 2019
Kommentiert: INGRUS
am 8 Dez. 2019
hi, I have a problem with a plot in a loop. I don't understand how I can plot the names of my variables.
The chart compares a fixed solution with others that vary
I would like to insert the name of the variable inside the legend for each cycle when I finish fighting, but I don't know how to do it. sorry but I'm a neophyte, I thank you in advance for your help.
for nvar =1:length(ID_var)
mat=load(['tr',ID_var{nvar},'.mat']);
Quota1=mat.Z;
n2=rot90(Quota1);
Quota=flipud(n2);
t=mat.T;
Temperatura1=squeeze(t(:,1,:,1));
for n=1:length(Dmis)
figure(n)
plot(Temperatura(:,Dmod(n)),Quota,'-')
hold on
plot(Tmis(:,Dmis(n)),-depthmis,'o');
legend({ID{nvar},'Dati misurati'},'location','northeastoutside');
drawnow;
xlabel('T[°C]')
ylabel('Z[m]')
grid on;
end
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 7 Dez. 2019
plot(Temperatura(:,Dmod(n)),Quota,'-', 'DisplayName', ID{nvar})
hold on
plot(Tmis(:,Dmis(n)),-depthmis,'o', 'DisplayName', 'Dati misurati');
legend('show', 'location','northeastoutside');
3 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Legend 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!