# difficulties with datetick and subplot dimensions

5 views (last 30 days)
Richard on 3 Dec 2012
I have several time series that I am trying to analyse and I am plotting all the series in different subplots and scatter plots. The date vector I have is in Julian dates, and I am having some problems in visualising the dates without it affecting the figure quality. Consider the following:
dat = 1-(20-1).*rand(365,8);
dat2 = 1-(20-1).*rand(365,8);
time = datenum('2009-01-01'):datenum('2009-12-31');
dtt = {'keepticks'};
for i = 1:8;
for ii = 1:2;
figure(ii);
ax = subplot(4,2,i);
plot(time,dat(:,i),'k');
hold on;
plot(time,dat2(:,i),'r');
if ii == 1;
datetick('x','mmm','keepticks');
else
datetick('x','mmm');
end
AX = get(ax,'position');
AX(3) = AX(3)./2;
set(ax,'position',AX);
axes('position',[AX(1)+AX(3) AX(2) AX(3) AX(4)]);
scatter(dat(:,i),dat2(:,i));
end
end
As you see, the difference between figure 1 and figure 2 is that in one I have specified to 'keepticks' (which is what I would like to do), but the two final plot dimensions vary, the format of the plots should be like figure 2. Why is this happening? How could I use keepticks but also have the subplots to maintain their dimensions?

### Community Treasure Hunt

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

Start Hunting!

Translated by