I have data like the following:
2006-06-02 245760 10240
2006-07-14 1167360 20480
2006-08-29 2375680 24576
2006-10-17 2375680 8192
2006-11-02 2375680 8192
2006-11-07 2375680 2300928
2006-11-27 2375680 1785856
2007-01-12 2375680 729088
and I want to get a graph with 2 lines (one for each y-column):
|
|-._ _.---
| '--------'
|-._
| '--------._.---
|
+---------------------
I know that "using" helps me in this scenario.
And it works if the data comes from a file:
plot "file.dat" using 1:2 with lines \
"" using 1:3 with lines
But I am processing this from within a perl script and have the data
in some memory structure so I would rather use stdin for the data,
instead of writing to a file and making gnuplot read this file.
plot "-" using 1:2 with lines \
"" using 1:3 with lines
... <perl feeds the datalines to stdin> ...
e
gives a "no data point found in specified file" error.
The same if I repeat the hyphen.
plot "-" using 1:2 with lines \
"-" using 1:3 with lines
A simple one graph per stdin data approach works:
plot "-" using 1:2 with lines
... < data from stdin > ...
e
(so I guess the syntax that I use is correct ...)
I know that gnuplot starts a new graph line if the data
is separated into blocks by an empty line. But that doesn't
really help me, because then both lines would have the the
same style/color and title.
Temporary files is really something that I would like to avoid.
The keyword is CGI, and using a pipe and stdin would get
me around file locking.
Thanks in advance for any ideas.
Rolf.
You should read "help datafile special-filenames" again. It even
contains an example doing exactly what you're trying to.
Thanks for pointing me out to the right topic in documentation.
If the datalines are repeated and also the final e indicator, plotting
the two lines works from stdin.
plot "-" using 1:2 with lines \
"-" using 1:3 with lines
... <perl feeds the datalines to stdin> ...
e
... < feed the same data again for the 2.line >
e
That's the way how it goes with manuals: If you know where it is
you find it. After going through all the options and descriptions
with "plot" I gave up and decided to consult the Usenet.
Thanks again, Rolf.