Software/MATLAB

[MATLAB] linkaxes: Subplot 축 확대 동기화

_winmin 2024. 12. 31. 10:46

서로 같은 축을 공유하는 Subplot끼리 (ex. 시계열 데이터) 데이터를 비교해야할 때

한 subplot 안에서 확대/축소가 다른 subplot에도 같이 적용되게 하는 방법이다.

 

ax1 = subplot(2,1,1);
% Plot 1st graph here


ax2 = subplot(2,1,2);
% Plot 2nd graph here

linkaxes([ax1 ax2],'x'); % 동기화 원하는 축 선택: 2D의 경우 'x' 또는 'xy'

 


Reference

https://kr.mathworks.com/help/matlab/ref/linkaxes.html