Why my subplot command skipping the first graph's title and labels?
Show older comments
This is my code where i am plotting two bar plot in one graph. However my first graph should be case:28 then case:29 as mentioned by the title. But my code is always skipping the first graph and pushing it at the end without anykind of label and title. I also attached my graph.
C28=rand(5,1);
figure(1)
title('Case:28','fontsize',10,"fontweight","Bold");
xlabel('Kinetic Mechanisms')
ylabel('SSE')
subplot(2,4,1)
hold on
for i = 1:length(C28)
h=bar(i,C28(i));
if C28(i) == min(C28)
set(h,'FaceColor','b');
elseif C28(i) == max(C28)
set(h,'FaceColor','r');
else
set(h,'FaceColor','k');
end
end
C29=rand(5,1);
figure(1)
title('Case:29','fontsize',10,"fontweight","Bold");
xlabel('Kinetic Mechanisms')
ylabel('SSE')
box on
subplot(2,4,2)
hold on
for i = 1:length(C29)
h=bar(i,C29(i));
if C29(i) == min(C29)
set(h,'FaceColor','b');
elseif C29(i) == max(C29)
set(h,'FaceColor','r');
else
set(h,'FaceColor','k');
end
end
hold off
Accepted Answer
More Answers (0)
Categories
Find more on Subplots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!