On Mon, 2 Mar 2020, Riccardo (Jack) Lucchetti wrote:
On Sun, 1 Mar 2020, Artur Tarassow wrote:
> > Maybe we could find a way to show dates, but there's not much space
> > available in "scatters". At least now we don't over-extend the
x-axis.
>
> Maybe its beneficial to rotate the x-labels to save some space. But it has
> no priority I guess.
Something like this, perhaps?
<hansl>
open IT_companies.gdt --frompkg=MGARCH
scatters 2 3 4 5 --output="(a)dotdir/x.gp"
s = readfile("(a)dotdir/x.gp")
# generate daily xtics
ntics = 6
v = round(seq(1, $nobs, $nobs/ntics))
xtics = "set xtics ("
loop i = 1 .. ntics --quiet
vi = v[i]
xtics ~= sprintf("\"%s\" %d", obslabel(vi), vi)
if i<ntics
xtics ~= ", "
endif
endloop
xtics ~= ") rotate by -45"
# modify gnuplot script and plot
s = regsub(s, "set xtics (.*)", xtics)
outfile "(a)dotdir/y.gp" --quiet
print s
end outfile
gnuplot --input="(a)dotdir/y.gp" --output=display
</hansl>
We already do something very much like this for an individual
time-series plot using daily data. Take Artur's example as a basis:
<hansl>
nulldata 40
setobs 7 2020-01-20
series a = normal()
gnuplot a --time --with-lines --output=display
</hansl>
This shows rotated date labels. In the case of scatters, where space
is at a premium, I doubt this will work nicely -- but it might be
worth experimenting.
Allin