0

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 Answer 1

0

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)
Sign up to request clarification or add additional context in comments.

1 Comment

This scales the graphs correctly, however this way one graph begins where the previous ended. (sorry if question was unclear, compare to i.imgur.com/OjQb6oj.png )

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.