1

I am trying to use the for syntax for multiple columns.

I have a data file colhead.dat:

Id a1 a2 a3
1  1  2  3
2  2  3  4
3  2  3  4

Following the answer https://stackoverflow.com/a/17525615/429850, I do

gnuplot>  plot for [i=2:5] 'colhead.dat' u 1:i w lp title columnheader(i)
                    ^
         ':' expected

How do i write the for loop? Here's the gnuplot version header

Version 4.2 patchlevel 6
last modified Sep 2009
System: Linux 2.6.32-71.el6.x86_64

1 Answer 1

3

For-loops have been implemented in version 4.6 of gnuplot, and there was nothing like loops in the versions before. So you have to update your version!


Edit: As Christoph mentioned, first for functionality was introduced in 4.4. However, 4.2 is too old.

Sign up to request clarification or add additional context in comments.

1 Comment

Actually, plot for was introduced in 4.4. Only do for was introduced later with 4.6 ;)

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.