Scaling Multiple Subplots to the Same Scale

조회 수: 55 (최근 30일)
Emily Doherty
Emily Doherty 2020년 9월 4일
편집: Bjorn Gustavsson 2020년 9월 8일
I have many subplots but they are different scales. How do i make them all have a y-axis from -200 to 200? Thank you.
  댓글 수: 2
Walter Roberson
Walter Roberson 2020년 9월 4일
If you have a vector of the handles of the axes then you can set() the YLim property of all of them.
Emily Doherty
Emily Doherty 2020년 9월 8일
I'm sorry I'm very new to MATLAB.. how would i do that?

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

답변 (1개)

Bjorn Gustavsson
Bjorn Gustavsson 2020년 9월 4일
편집: Bjorn Gustavsson 2020년 9월 8일
A usefult tool to utilize for this is linkaxes - that allows you to something like this:
for i1 = 1:many
sph(i1) = subplot(many,1,i1)
plot(x,y)
end
linkaxes(sph,'y')
ax = axis;
axis([ax(1:2) -200 200])
This should keep ylims equal in all your subplots - if you modify it in one the others will follow.
HTH

카테고리

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