Ylim for bar subplot

조회 수: 13 (최근 30일)
Xuanyi Zhou
Xuanyi Zhou 2022년 6월 27일
댓글: Xuanyi Zhou 2022년 6월 28일
This is my code and yi perfer toadd a ylim([0,6]); for the last subplot. BUt it looks doesn't work.
figure(1);
x=data(:,1)/1000;
y1=data(:,2);
y2=data(:,3);
y3=data(:,4);
Y=[y1;y2;y3];
y111=data3(:,2);
y222=data3(:,3);
y333=data3(:,4);
Y2=[y111;y222;y333];
subplot(3,1,1);
% plot(x,y1);
h1=bar(x,[y1,y111]);
% h1 = bar(y1);
set(h1, {'DisplayName'}, {'offline ic\_input','real-time ic\_input'}')
legend('FontSize', 12)
hold on;
subplot(3,1,2);
% plot(x,y2);
h2 = bar(x,[y2,y222]);
% h2 = bar(y2);
set(h2, {'DisplayName'}, {'offline ic\_output','real-time ic\_output'}')
legend('FontSize', 12)
hold on;
subplot(3,1,3);
  댓글 수: 3
Pooja Kumari
Pooja Kumari 2022년 6월 27일
Can you share the data you were using?
Xuanyi Zhou
Xuanyi Zhou 2022년 6월 28일
Yeah, here it is. Thank you so much.

댓글을 달려면 로그인하십시오.

답변 (1개)

Walter Roberson
Walter Roberson 2022년 6월 27일
subplot(3,1,3);
By default ylim() applies to the current axes. You just called subplot() so the current axes is the third one, which you have not drawn into yet.
  댓글 수: 1
Xuanyi Zhou
Xuanyi Zhou 2022년 6월 28일
Thank you so much

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Subplots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by