Specifying properties of a subplot
조회 수: 3 (최근 30일)
이전 댓글 표시
Hello,
I am trying to create a pdf figure in landscape view using Matlab. The figure is a 2X2 subplot that includes four different time series (I'm calling them North_cold, North_warm, South_cold, and South_warm). The time series need to be the same size and they need to be aligned with one another. Ideally, each subplot would be 2.5 inches tall and 4 inches wide, with a 1/4 inch space between them. Each time series will also have a title. I will have to align the figure in the middle of the page when it prints.
Any suggestions for how I can accomplish this would be greatly appreciated.
댓글 수: 0
답변 (1개)
Azzi Abdelmalek
2014년 2월 1일
t=0:.1:10;
y=sin(t);
figure(1)
sp_v=1; % vertical space
sp_h=0.25; % horizontal space
w=4; % width
h=2.5; % height
marg=1; % margines
set(gcf,'units','inches','position',[0.5,0.5,w*2+sp_h+2*marg,h*2+sp_v+2*marg])
v=[marg marg+h+sp_v w h;w+marg+sp_h marg+h+sp_v w h;marg marg w h;w+marg+sp_h marg w h]
for k=1:4
subplot(2,2,k),
plot(t,y)
title(sprintf('title%d',k));
xlabel('x')
ylabel('y')
set(gca,'units','inches')
set(gca,'position',v(k,:))
end
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Subplots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!