1

With GNU Plot, I normally process x, y, z data in three separate columns:

x1, y1, z1
x2, y1, z2
...
...
xn, yn, zn

and I used splot 'filename.ext' with lines to quickly get the a 3D plot

Due to our new system requirements, we have to store data in the following form:

x1
y1
z1
x2
y2
z2
.
.
xn
yn
zn

I already written a simple code in C# to transform our results into 3 columns for easy viewing in GNU Plot.

My question is, if the data is now only a one dimensional array, is there a way to plot this in GNU Plot directly without having my program to re-saved our results as a 3 columns results?

Thank you.

Regards, ikel

Additional info: I am running on Win7, 64 bit, and using the Win binaries of GNU Plot. Apparently, I don't have paste, sed and popen (see discussion below).

ikel
  • 518
  • 2
  • 6
  • 27
  • Have a look at `every`. With some mock test data and an image of the desired output, we could try more... – vaettchen Jan 18 '13 at 07:21

1 Answers1

2

I don't know how to make Gnuplot interpret the input as groups of three, but if your version of Gnuplot supports popen, you can join the lines on the fly with e.g. paste or sed:

splot '< paste - - - < filename.ext' with lines

Or:

splot '< sed "N; N; s/\n/ /g" filename.ext' with lines
Thor
  • 45,082
  • 11
  • 119
  • 130
  • Thank you for your suggestion. I tried to run both of your commands and I ended up with `No usable data in this plot to auto-scale axis range. All points x value undefined.` I don't know if popen is available on my Windows distribution of GNU Plot. – ikel Jan 18 '13 at 09:36
  • 2
    @ikel -- Your gnuplot might not have `popen`, or alternatively, you might not have `paste` or `sed` installed. – mgilson Jan 18 '13 at 13:37
  • Is there a way to install these features? – ikel Jan 18 '13 at 20:48
  • 1
    @ikel: There's a good [discussion here](http://stackoverflow.com/questions/127318/is-there-any-sed-like-utility-for-cmd-exe) about installing sed on Windows, some of the suggested solutions also provide coreutils which paste is a part of. By the way [Gnuplot is not part of GNU](http://www.gnuplot.info/faq/faq.html#SECTION00037000000000000000). – Thor Jan 19 '13 at 14:50
  • 1
    @Thor `splot '< sed "N; N; s/\n/ /g" filename.ext' with lines` works after installing cygwin, which provides access to `sed.` Thank you. This [link](http://www.grymoire.com/Unix/Sed.html#uh-51) helped me to understand what your complete and minimalistic solution – ikel Jan 24 '13 at 23:54