gnuplot -
the input is interactive BUT I do not have history. Why is it so? I
think it would be nice to access history from batch script and,
surely, from an interactive session started with the special '-'
filename.
Looking at the code, I've notice that in plot.c the history set up
part is inside an if (interactive && term != 0){...} condition. Just
moving this part out of the 'if' gave me access to history from batch
(for instance gnuplot -e 'history 10' print the list of last 10
commands). I surely made horrible programming mistakes, BUT I think I
proved that the thing is feasible :-). I work in Linux. The patch
follows.
Giulio
Index: src/plot.c
===================================================================
RCS file: /cvsroot/gnuplot/gnuplot/src/plot.c,v
retrieving revision 1.104
diff -r1.104 plot.c
540d539
< if (interactive && term != 0) { /* not unknown */
569c568
<
---
> if (interactive && term != 0) { /* not unknown */
Because gnuplot, in this case, is not in interactive mode of operation.
The '-' command-line argument is meant for use with programs
controlling gnuplot from the outside (after having loaded some scripts
first), not for actual interactive usage by people.
Thank you for your reply. When I'm doing "data exploration" I like to
be able to plot directly
from the command line. For this purpose I wrote a little shell
function 'gbplot' that I use,
for example, in this way
program_that_generates_data | gbplot -i plot u 0:1 w lp
the script opens a terminal controlling a gnuplot session, displays
the plot, and enters
and interactive session in whcih I can change axes scale or set log or
whatever seems
interesting to do. The function code can be found here (it's a zsh
function; does not work
in bash) http://giulio.bottazzi.googlepages.com/zshrc This method is
more practical than
first opening a gnuplot session and then use
plot "< program_that_generates_data"
Essentially the script works by building two suitably defined
temporary files 'CMDFILE' and
'ENDFILE' and starts gnuplot with
gnuplot $CMDFILE - $ENDFILE
Everything works nicely (because gnuplot is a fantastic program) APART
being able to access
previous history. I miss this feature because being data exploration a
back and forth exercise, I
often find myself re-typing the same lines.
Sorry for the long post. I think it was useful to clarify why I think
this feature could be of some use.
Best,
G.
P.S.: By the way, gnuplot's help says:
To launch an interactive session after an initialization file
"header" and
followed by another command file "trailer":
gnuplot header - trailer