On Fri, 17 May 2019, Riccardo (Jack) Lucchetti wrote:
Folks,
I need to generate a time-series picture with NBER-style recession bands. This
is very easy to do via the GUI, but not very much so from a script. So I put
together the following function, that has a few flaws but gets the basic job
done:
<hansl>
function void plot_with_band(list X, series band)
smpl X band --contiguous
scalar y0 = min(min(X))
scalar y1 = max(max(X))
scalar m = (y1+y0)/2
scalar w = (y1-y0)/1.5
series band_w = band ? w : 0
series band_c = band ? m : NA
band_c[$t1] = m
band_c[$t2] = m
plot X
options time-series with-lines
options band=band_c,band_w,1 band-style=fill
end plot --output=display
end function
### example
open AWM17
series band = (t > 1990:1) && (t<1994:4) || (t > 2000:1) &&
(t<2004:4)
list X = CAN_YEN URX
plot_with_band(X, band)
</hansl>
Now, I can see three possibilities:
* just add this example to the User's Guide * refine the function and make it
a function package
* enhance the gnuplot command and the plot block with special syntax
I would find number 3 preferable, if we weren't just before release, and I
don't really feel like pushing release ahead for this. But OTOH, if we decide
to put this off for gretl 2019c, then options 1 and 2 are not really
worthwhile, are they?
Ideas?
It should be scriptable via the "plot" command (number 3), agreed.
I've been delaying the 2019b release as I messed with vif/bkw but I
think that's about ready now and I'd rather not delay it much longer.
So I'd go for deferring this to 2019c.
Allin