필터 지우기
필터 지우기

How to make 3 bar subplots have the same scale?

조회 수: 21 (최근 30일)
Zhangziyi Zhou
Zhangziyi Zhou 2022년 4월 21일
답변: Matt J 2022년 4월 21일
I have a plot with 3 subplot of barplots. How do I set the same axis range for all three of them?

답변 (2개)

Voss
Voss 2022년 4월 21일
Use the output from subplot to store the axes. Then set the XLim and YLim of the axes.
figure
ax = zeros(3,1);
ax(1) = subplot(3,1,1);
bar(1:10,3*rand(1,10))
ax(2) = subplot(3,1,2);
bar(1:20,2*rand(1,20))
ax(3) = subplot(3,1,3);
bar(1:30,rand(1,30))
set(ax,'XLim',[-5 35],'YLim',[-2 5],'XTickMode','auto','YTickMode','auto');

Matt J
Matt J 2022년 4월 21일
axis( findobj(gcf,'Type','axes'), [xmin, xmax,ymin,ymax])

카테고리

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

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by