Dear gentlemen and ladies,

After some extensive work with scripts, I was a bit frustrated when I figured out that plots brought onto display via
gnuplot STUFF --output=display
are shut down after the *nulldata* command. Consider the following example:

<hansl>
nulldata 50
set seed 20140624
series x = sort(randgen(u,0,10))
set seed 20140625
series normerr = randgen(n,0,1)
set seed 2024
series baderr = randgen(t,1)
series y = 2+0.5*x + (index>40 ? baderr : normerr)
# Let's look at those odious outliers
gnuplot y x --output=display --linear-fit

# Bootstrap
matrix Y = y
matrix X = x
matrix DATA = Y~ones(50,1)~X
scalar iters = 100000
matrix betas = zeros(iters,2)
loop i=1..iters --progressive --quiet
    matrix D = resample(DATA)
    betas[i,] = mols(D[,1], D[,2:3])'
endloop
nulldata iters --preserve
# Because kdensity does not favour matrices, series only!
series bs2 = betas[,2]
matrix ker2 = kdensity(bs2)
gnuplot 2 1 --matrix=ker2 --with-lines --suppress-fitted --output=display
</hansl>

As you can see, the desired output consists of two plots, the scatterplot and the bootstrap distribution of the coefficient. However, much as I would like to look at them side-by-side, it is impossible since the *nulldata* command eliminates the original series and somehow closes the plot window (verified via console, too). So things go smoothly as long as we use the same dataset, but even the preservation of matrices does not prevent the plot window from being shut down. Is it a bug or a feature? Can such forceful behaviour be somehow overridden?

--
Yours sincerely,      | С уважением,
Andreï V. Kostyrka. | Андрей Викторович Костырка.
http://kostyrka.ru, http://kostyrka.ru/blog