0
votes

My datafile looks like this:

#lap speed
1 10
1 12
1 15
1 8
1 15
1 10
2 20
2 25
2 15
3 16
3 17
3 16
3 18

(The speed is logged at regular intervals and the first number is the lap/run.)

I want to plot the speed as overlapping line-graphs and each run/lap should be its own graph.

My script so far:

topspeed=30
set multiplot
do for [lap=1:3] {  
    set yrange [0:topspeed] 
    set autoscale fix   
    plot "testdata.txt" using ($1 != lap ? 1/0 : $2) with lines title "speed"
}

unset multiplot

This script outputs:

undesired output

However a lap/run can have different durations and produce variable amount of datapoints.

At the moment all graphs use their own scale and get "stretched" to the same length.

What I try to archive is this:

desired output

I think somehow 'xrange' needs to be set, but various attempts with "set xrange" & "autoscale" were unsuccessful.

1

1 Answers

0
votes

Don't do a multiplot, but rather one plot with several lines:

set yrange [0:30]
plot for [lap=1:3] "testdata.txt" using ($1 != lap ? 1/0 : $2)