Specifying properties of a subplot

4 次查看(过去 30 天)
Shannon
Shannon 2014-2-1
评论: Shannon 2014-2-2
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.

回答(1 个)

Azzi Abdelmalek
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 CenterFile Exchange 中查找有关 Axis Labels 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by