Bar graph - plot data
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Francesco Marchione
am 31 Mär. 2023
Bearbeitet: Dyuman Joshi
am 31 Mär. 2023
Hello, I would like to plot a graph like this. Can anyone help me in writing this code?
Thank you so much![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1341284/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1341284/image.png)
3 Kommentare
Akzeptierte Antwort
Antoni Garcia-Herreros
am 31 Mär. 2023
Hello Francesco,
close all
data=[2,3;2,6;2,6;2,6];
ax=axes;
b=bar(data);
ylim([0 12])
L1 = ["Mu" "Tau"];
a3=[b(1).XEndPoints; b(2).XEndPoints];
x3=a3(:)';
yp1 = -0.5*ones(size(x3));
yp2 = 2.5*yp1;
ax.XTickLabel={''};
for i=1:2:numel(x3)
text(x3(i)-0.08, yp1(i), L1(1))
text(x3(i+1)-0.08, yp1(i), L1(2))
end
L2=['1' '2' '3' '4'];
for i=1:4
text(i, yp2(i), L2(i))
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Bar Plots 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!