3

I want to write gnuplot command for a file which just I have one column of that. In the file and that column is Y, But in the file I don't have X's column.X's column element are

1
2
3
4
5
6
7

.Pay attention to the belowe think they are my in file witch they "

12
43
65
76
12
56

" As you see I have Y's element but I do not have X's element in my file,I mean X elemat is based on the row number.I guess there should be an command in gnuplot which does this.

Eric Carvalho
  • 55,453

2 Answers2

7

This is the default behaviour for single column files. The difference is that the standard numbering is to number x=0,1,2,...

Here's my data (in file temp.dat)

12 
43 
65 
76 
12 
56

Plot with

    gnuplot> plot "temp.dat" with linespoints title "Single column data"

or similar.

To shift the x-axis so that x=1,2,3...

    gnuplot> plot "temp.dat" using ($0+1):1 with linespoints title "Single column data"
0

I was able to get this working by cat'ing the file and then plotting: cat temp.dat | gnuplot -p -e "plot '<cat' with linespoints"

james-see
  • 254
  • 2
  • 9