Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
618 views
in Technique[技术] by (71.8m points)

gnuplot - How can i reduce the linear fit plot to a certain interval?

what i do is to fit two linear function′s to my data. i know how to select the data for the various fitting functions. My problem is that i want the fitted lines only to be plottet in a certain interval. What i did till now:

f(x) = a*x + b; fit [800:1250][-2:8] f(x) 'Daten.txt' u 1:2 via a,b   

g(x) = c*x + d; fit [1258:1650][-2:8] g(x) 'Daten.txt' u 1:2 via c,d                                                                            

plot "Daten.txt" u 1:2 w l, f(x) t title_f(a,b), g(x) t title_g(c,d)                                                            

it results in

a picture i′m not allowed to post...

How can i make the green fittin-line only to run from 800-1200 and the blue fitting-line from 1100-end?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The syntax

plot [xmin:xmax] f(x)

(the same as for fit) restricts the plot to a certain range. So, you could do something like

plot "Daten.txt" u 1:2 w l, [800:1200] f(x) t title_f(a,b), [1100:] g(x) t title_g(c,d)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...