I was fooling around with MEI data (https://en.wikipedia.org/wiki/Multivariate_ENSO_index) from here
http://www.esrl.noaa.gov/psd/enso/mei/table.html
In essence MEI quantifies the El Niño-La Niña cycle, positive values flagging El Niño and negative values flagging La Niña.
Once reshaped from their idiosyncratic dataset structure, which has its own logic, I created this graph, which might interest some on various grounds, perhaps especially people working with economic or financial data going up and down in irregular but definite cycles.
The main trick is to separate the time series into positive or negative variables (or more generally, values above and below some reasonable reference level).
I am not normally especially fond of area graphs, but I thought this one worth sharing.
Note: In this case twoway area could be used directly, as the default of zero as the base is exactly what is needed. But the code above is easy to extend to other cases. Alternatively, use twoway area with base().
http://www.esrl.noaa.gov/psd/enso/mei/table.html
In essence MEI quantifies the El Niño-La Niña cycle, positive values flagging El Niño and negative values flagging La Niña.
Once reshaped from their idiosyncratic dataset structure, which has its own logic, I created this graph, which might interest some on various grounds, perhaps especially people working with economic or financial data going up and down in irregular but definite cycles.
The main trick is to separate the time series into positive or negative variables (or more generally, values above and below some reasonable reference level).
Code:
separate MEI, by(MEI>=0) gen zero = 0 twoway rarea MEI1 zero mdate, color(red*0.8) cmissing(no) || rarea MEI0 zero mdate, color(blue*0.8) cmissing(no) legend(off) ytitle(MEI) yla(, ang(h)) xla(`=ym(1950, 1)'(120)`=ym(2010,1)') xtitle("") aspect(0.5)
Note: In this case twoway area could be used directly, as the default of zero as the base is exactly what is needed. But the code above is easy to extend to other cases. Alternatively, use twoway area with base().
Comment