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).

1
  • Have a look at every. With some mock test data and an image of the desired output, we could try more... Commented Jan 18, 2013 at 7:21

1 Answer 1

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
Sign up to request clarification or add additional context in comments.

5 Comments

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 -- Your gnuplot might not have popen, or alternatively, you might not have paste or sed installed.
Is there a way to install these features?
@ikel: There's a good discussion here 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.
@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 helped me to understand what your complete and minimalistic solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.