Seriously
Seriously

Reputation: 980

gnuplot: make autotitle ignore header lines

I want to use gnuplot to plot several lines from a csv file which has a not fixed number of header lines and columns. The file might look like this:

HEADERLINE1           = TEXTTEXTTEXT 
HEADERLINE2           = TEXTTEXTTEXT
HEADERLINE3           = 1248243 
HEADERLINE4           = 329340


COLUMN_X      COLUMN_1       COLUMN_2
       1       36.9194        30.0000
       2       19.0977        20.0000
       3       12.9250        10.0000
       4       10.7134         0.0000

Normally without the header lines I would use something like this:

stats 'datafile.csv' nooutput
set key autotitle columnheader
plot for [t=2:STATS_columns] \
  datafile \
  using 1:t \
  with linespoints

However with the header lines those are used by the autotitle command. Is there a way to tell autotitle to pick the columnheads from the actual columns / second block / ignore the header?

Thanks

Upvotes: 0

Views: 1448

Answers (1)

vaettchen
vaettchen

Reputation: 7659

Provided that there are always at least two blank lines between the header lines and the data, you can use index. stats gives you some warnings but the result is as desired:

stats "so.dat" nooutput
set key autotitle columnheader
plot for [t=2:STATS_columns] \
  "so.dat" \
  index 1\
  using 1:t \
  with linespoints

yields

enter image description here

Upvotes: 2

Related Questions