How to use 'dates' and 'axis tight' for charts my data are in quarters in Matlab

Hi there I have a code written to plot charts in quarters in matlab but need help on that. thanks. I attach the code and the data (127 observations) 1975q3-2007q3

Answers (1)

You’re not plotting any specific values for your independent variables. I can’t tell from using matfile on ‘innovations.mat’ if there is a date vector. You have to plot a vector of datenumbers, then use datetick. See the documentation for the datetick function, particularity the discussion of ‘dateFormat’ under ‘Input Arguments’.

4 Comments

Can you give me an example here please?
Here is a way of doing it with months and days:
t = now + (1:7);
y = 2*t;
figure(1)
plot(t, y)
grid
datetick('x', 'dd/mm','keepticks')
xlabel('Date (day/month)')
Post a representative vector of dates for your data. I do not have your date data so I cannot plot it by quarters.
See the documentation for datetick that I linked to in my Answer. It will give you the information you need.

Sign in to comment.

Asked:

on 20 Nov 2014

Commented:

on 22 Nov 2014

Community Treasure Hunt

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

Start Hunting!