1

I have multiple data files in a directory and want to generate one plot from all of them. Every datafile has an own columnhead (set key autotitle columnhead).

It works when I plot one graph (one "using") statement. If I have multiple using statements, only the first is plotted correctly, for the others only the first datapoint is processed (only one label, one yerrorbars, but 5 linepoints)

gnuplot statements:

set key autotitle columnhead                  
files = system("echo $(ls *.csv)")

plot for [i=1:words(files)] word(files,i) using 0:2:xtic(1) with lp ,\
'' using 0:2:2 with labels font ',8' offset 1,0.5 notitle "",\ 
'' using 0:2:3 with yerrorbars lt -1 lc rgb 'grey' title "" 

If I only plot labels or only yerrorbars they are also correct, it's only broken when I'm using multiple "using" statements with "plot for".

Anybody have an idea what I'm doing wrong?

Gnuplot version: 4.6.5

thanks a lot (gnuplot is driving me crazy)

1
  • I don't quite get what you want to achieve. Could you try to abstract and give an example of what your .csv files contain? Commented Aug 1, 2014 at 14:46

1 Answer 1

2

The for iteration applies only to the first command. In order to iterate also in the following commands, you must repeat the iteration:

set key autotitle columnhead                  
files = system("echo $(ls *.csv)")

plot for [f in files] f using 0:2:xtic(1) with lp ,\
     for [f in files] f using 0:2:2 with labels font ',8' offset 1,0.5 notitle "",\ 
     for [f in files] f using 0:2:3 with yerrorbars lt -1 lc rgb 'grey' title "" 

Note, that in your case (you don't need the iteration index i) you can directly iterate over the files.

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

Comments

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.