On Fri, 11 Dec 2015, Allin Cottrell wrote:
On Fri, 11 Dec 2015, Artur Tarassow wrote:
> <hansl>
> clear
> set echo off
> set messages off
> open denmark.gdt -q
>
> function void indplot(list L1, list L2)
> list lplot = L1|| L2
> string S1 = varname(L1)
> string S2 = varname(L2)
> plot lplot
> option with-lines=@S1
> option with-impulses=@S2
> option time-series
> #literal set term pdfcairo font 'Helvetica,14' lw 1
> literal set key outside below
> literal set linetype 2 lc rgb 'black' lw 2
> literal set linetype 1 lc rgb 'blue'
> literal set linetype 3 lc rgb 'red' lw 2
> end plot --output=display
> end function
>
> list L1 = LRM
> list L2 = IBO
> indplot(L1,L2)
> # [...]
> </hansl>
This is to do with the handling of list arguments to gretl functions, which
is inherently tricky [...]
And so here's a suitably tricky solution (but maybe we can come up
with a better way of doing this sort of thing).
<hansl>
function void indplot(list L1, list L2)
list lplot = L1|| L2
string S1
loop foreach i L1 -q
S1 += "L1.$i "
endloop
string S2
loop foreach i L2 -q
S2 += "L2.$i "
endloop
plot lplot
option with-lines=@S1
option with-impulses=@S2
option time-series
literal set key outside below
literal set linetype 2 lc rgb 'black' lw 2
literal set linetype 1 lc rgb 'blue'
literal set linetype 3 lc rgb 'red' lw 2
end plot --output=display
end function
</hansl>
Allin