plots of dates

1 visualizzazione (ultimi 30 giorni)
antonet
antonet il 1 Giu 2012
Dear all, I have a panel data across countries and individuals. For each country I have a sequence of dates For France for example 22/02/09 22/03/09 19/04/09 17/05/09 12/07/09 09/08/09 06/09/09 04/10/09 01/11/09 29/11/09 27/12/09 31/01/10
For Italy 14/06/09 12/07/09 09/08/09 06/09/09 04/10/09 01/11/09 29/11/09 27/12/09 31/01/10 28/02/10 28/03/10
I And I want to “plot” (in one graph) these sequences of dates in the sense that I want to have a”visual” contact of each of the behaviour of the series of dates because as you can see I do not have the same start date and end date and the next date is not always every 28 days. So I have a jump in some cases. I would like to visualize these characteristics of the two series of dates by making a plot. Any suggestions?

Risposta accettata

Oleg Komarov
Oleg Komarov il 1 Giu 2012
% Suppose you have the following cell array:
dates = {{'22/02/09' '22/03/09' '19/04/09' '17/05/09' '12/07/09' '09/08/09' '06/09/09' '04/10/09' '01/11/09' '29/11/09' '27/12/09' '31/01/10'}
{'14/06/09' '12/07/09' '09/08/09' '06/09/09' '04/10/09' '01/11/09' '29/11/09' '27/12/09' '31/01/10' '28/02/10' '28/03/10'}};
% Convert to serial dates
serdates = cellfun(@(x) datenum(x,'dd/mm/yy'),dates,'un',0);
% Create figure and axes
figure('units','pixels','position',[100 100 500 180])
axes('NextPlot','add','Ylim',[0 3],'Ytick',1:2,'YtickL',{'France','Italy'},...
'units','pixels','position',[70 45 400 100])
% Plot (you can automate with loop)
plot(serdates{1},ones(numel(serdates{1}),1)*1,'-bs')
plot(serdates{2},ones(numel(serdates{2}),1)*2,'-rd')
% Can customize the x axes (here totally basic)
datetick

Più risposte (0)

Categorie

Scopri di più su Dates and Time in Help Center e File Exchange

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by