Legend of a plot out of table first row

16 ビュー (過去 30 日間)
Frederik Reese
Frederik Reese 2022 年 5 月 10 日
回答済み: Voss 2022 年 5 月 11 日
Hi
I have the attached table. I Plot in a for loop an want as a legend the first row of the table.
Can someone help me ?
Thanks
  2 件のコメント
Frederik Reese
Frederik Reese 2022 年 5 月 10 日
A= [1:196];
A = array2table (A)
%11: 16:51, 12: 52:84 13:85:117
%11:6:17, 12: 18:28, 13: 29:39
ModellD_BHQ = PegelpunktetimeseriesneuCopy(1:3:end, :)
ModellD_HQ5000 = PegelpunktetimeseriesneuCopy(2:3:end, :)
ModellD_HQ10000 = PegelpunktetimeseriesneuCopy(3:3:end, :)
ModellD_HQ10000 = removevars(ModellD_HQ10000, 'Linkes_Uferwspl_D_Ist_beidseitig');
ModellD_BHQ = removevars(ModellD_BHQ, 'Linkes_Uferwspl_D_Ist_beidseitig');
ModellD_HQ5000 = removevars(ModellD_HQ5000, 'Linkes_Uferwspl_D_Ist_beidseitig');
ModellD_HQ50001 = ModellD_HQ5000{:,1:84};
ModellD_HQ100001 = ModellD_HQ10000{:,1:84};
ModellD_BHQ1 = ModellD_BHQ{:,1:84};
for i=29:39
sgtitle('WSPL zeitlicher Verlauf Modell D Pegelpunkte FKM 113')
subplot(3,1,1)
plot(ModellD_BHQ{i,:})
hold on
grid on
title ('BHQ')
xlabel ('Zeit [h]')
ylabel ('WSPL [m]')
subplot(3,1,2)
plot(ModellD_HQ5000{i,:})
hold on
grid on
title ('HQ5000')
xlabel ('Zeit [h]')
ylabel ('WSPL [m]')
subplot(3,1,3)
plot(ModellD_HQ10000{i,:})
hold on
grid on
title ('HQ10000')
xlabel('Zeit [h]')
ylabel ('WSPL [m]')
end
This is my plot code and i want to plot the Names in the first row ( for example " 114 VL_L - wspl_D_Ist_beidseitig (3)") as legend for the data which are plot
is it clearer now?

サインインしてコメントする。

採用された回答

Voss
Voss 2022 年 5 月 11 日
I'm not sure where the legends are supposed to fit, but here you go:
S = load('PegelpunktetimeseriesneuCopy');
PegelpunktetimeseriesneuCopy = S.PegelpunktetimeseriesneuCopy;
ModellD_BHQ = PegelpunktetimeseriesneuCopy(1:3:end, :);
ModellD_HQ5000 = PegelpunktetimeseriesneuCopy(2:3:end, :);
ModellD_HQ10000 = PegelpunktetimeseriesneuCopy(3:3:end, :);
ax = [ ...
subplot(3,1,1) ...
subplot(3,1,2) ...
subplot(3,1,3) ...
];
title(ax(1),'BHQ')
title(ax(2),'HQ5000')
title(ax(3),'HQ10000')
hold(ax,'on')
grid(ax,'on')
xlabel(ax,'Zeit [h]')
ylabel(ax,'WSPL [m]')
h = [ ...
plot(ax(1),ModellD_BHQ{29:39,2:end}.') ...
plot(ax(2),ModellD_HQ5000{29:39,2:end}.') ...
plot(ax(3),ModellD_HQ10000{29:39,2:end}.') ...
];
leg = [ ...
legend(h(:,1),ModellD_BHQ{29:39,1}) ...
legend(h(:,2),ModellD_HQ5000{29:39,1}) ...
legend(h(:,3),ModellD_HQ10000{29:39,1}) ...
];
set(leg,'Interpreter','none','Location','EastOutside');
sgtitle('WSPL zeitlicher Verlauf Modell D Pegelpunkte FKM 113')

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by