How to add a table beneath a plot?
Afficher commentaires plus anciens
I want to add a table beneath the the x-axis as shown in the picture.
I have made the plot, but not sure how to add the additional table. This is my code:
B30_R = [0.1305,0.2031,0.2735,0.2584,0.40526,0.5471,0.3835,0.5795,0.8407];
U30_R = [0.1291,0.1429,0.1516,0.2707,0.2861,0.3033,0.4216,0.4420,0.4586];
S30_R = [0.0879,0.1027,0.1131,0.1800,0.2060,0.2262,0.2754,0.3274,0.3473];
V30_R = [0.1351,0.1359,0.1272,0.2904,0.2722,0.2544,0.4609,0.4210,0.3758];
figure()
hold on
plot(V30_R)
plot(U30_R)
plot(S30_R)
plot(B30_R)
xlabel('Sea state')
ylabel('RMS Roll [deg.]')
title('RMS in roll at 30 deg')
legend('Violin','UT540','SWATH','Base case')
hold off
Réponse acceptée
Plus de réponses (1)
Matthias Kößling
le 3 Juin 2020
You could do it similar to this (but you have to play with the positions and the gap value):
B30_R = [0.1305,0.2031,0.2735,0.2584,0.40526,0.5471,0.3835,0.5795,0.8407];
U30_R = [0.1291,0.1429,0.1516,0.2707,0.2861,0.3033,0.4216,0.4420,0.4586];
S30_R = [0.0879,0.1027,0.1131,0.1800,0.2060,0.2262,0.2754,0.3274,0.3473];
V30_R = [0.1351,0.1359,0.1272,0.2904,0.2722,0.2544,0.4609,0.4210,0.3758];
figure();
axes('Position',[.1 .3 .8 .6]);
hold on;
plot(V30_R)
plot(U30_R)
plot(S30_R)
plot(B30_R)
xlabel('Sea state')
ylabel('RMS Roll [deg.]')
title('RMS in roll at 30 deg')
legend('Violin','UT540','SWATH','Base case')
hold off;
uicontrol('Style','Text','String','H [m]','FontSize',14,'Units','Normalized','HorizontalAlignment','Left','Position',[.03 .1 .05 .05]);
uicontrol('Style','Text','String','T [s]','FontSize',14,'Units','Normalized','HorizontalAlignment','Left','Position',[.03 .05 .05 .05]);
H_S = [0.25 0.75 1.25 1.75 2.25 2.75 3.25 3.50 3.75 4.25 4.75];
T_P = [4.5 4.5 5.5 6.5 7.5 7.5 8.5 8.5 8.5 9.5 9.5];
Gap = 0.8/(length(H_S)-1);
for Column = 0:1:length(H_S)
uicontrol('Style','Text','String',num2str(H_S(Column+1)),'FontSize',14,'Units','Normalized','HorizontalAlignment','Left','Position',[.1+Gap*Column .1 .05 .05]);
uicontrol('Style','Text','String',num2str(T_P(Column+1)),'FontSize',14,'Units','Normalized','HorizontalAlignment','Left','Position',[.1+Gap*Column .05 .05 .05]);
end
Catégories
En savoir plus sur Line Plots dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
