Specifying properties of a subplot

7 views (last 30 days)
Shannon
Shannon on 1 Feb 2014
Commented: Shannon on 2 Feb 2014
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.

Answers (1)

Azzi Abdelmalek
Azzi Abdelmalek on 1 Feb 2014
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 Comments
Shannon
Shannon on 2 Feb 2014
Okay, thank you anyways :)

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!