Using listdlg along with case statement

1 Ansicht (letzte 30 Tage)
callum hayes
callum hayes am 1 Dez. 2022
Bearbeitet: VBBV am 1 Dez. 2022
Ive used the listdlg along with the case statements so the user can plot two bars graphs.Ive used 'hold on' and 'hold off statements to plot two bar graphs ontop of eachother. However the bar graphs seem to shift to the right one place?Also any idea how to seperate the colours like 'e','f','g', for some reason the colours dont seperate for the first three bars.

Akzeptierte Antwort

VBBV
VBBV am 1 Dez. 2022
Bearbeitet: VBBV am 1 Dez. 2022
A = [15 22 25 17 7 3 2 2];
B = [17 23 27 15 5 2 1 1];
% ---^^^^^^^^ these values in B are higher compared to A
length(B)
ans = 8
length(A)
ans = 8
X = 1:8; %
bar(X,A,'g'); %
hold on
bar(X,B,'r') %
xticklabels({'A*','A','B','C','D','E','F','G'}); % ensure ticklabels count and ticks are equal
ylim([0 30])

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D 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!

Translated by