1
votes

I have a single column of data (say 100 samples):

plot 'file' using 1 with lines

But this data is segmented: 10 points, then 10 more, etc... and I'd like each block of 10 to appear in a different color. I did filter them to 10 separate files and used

plot 'file.1' with lines, 'file.2' with lines...

But then the X axis goes 0..10 instead of 0..100 and all 10 graphs are stacked. Is there a simple way to do that without having to generate fake X data ?

1
What does segmented mean for you? separated by an empty line or no empty lines between your blocks?theozh

1 Answers

3
votes

Depending on your detailed data format... the following is doing what I think you are asking for. Your "fake x data" is called pseudocolumn 0, check help pseudocolumns. The color you can change with lc var, check help linecolor variable.

Code:

### variable line color
reset session

# create some test data
set print $Data
    do for [i=1:100] {
        print sprintf("%g", rand(0)*i)
    }
set print

plot $Data u 0:1:(int($0/10)) w lp pt 7 lc var notitle
### end of code

Result:

enter image description here