2013-07-18 116 views
2

gnuplot可以計算兩行之間的距離還是兩個點之間的距離?gnuplot - 計算行之間的距離

我有一個繪製兩條(主)線的情節。現在讓我們假設第一行總是在第二行之上。有沒有一種方法可以計算給定x值時從第2行到第1行的距離?

這裏是我想計算一下我的情節看起來像和距離的畫面:

the solid horizontal line is line 1, the dotted horizontal line is line 2

垂直線只是風格和什麼都沒有做實際的情節,他們的數據存儲在test.dattest2.dat中。該行的

我的數據文件看起來像這樣:
一號線

0  118.1 
2.754 117.77 
4.054 117.64 
6.131 116.17 
7.7  116.04 
8.391 115.36 
10.535 115.25 
11.433 116.03 
12.591 116.22 
19.519 118.59 

2號線

19.4 118.51 
15.2 116.56 
10.9 115.94 
10.35 114.93 
9.05 114.92 
8.3  115.9 
5.9  116.19 
4.2  116.62 
2.2  117.66 
-0.3 118.06 

我的繪製代碼如下所示:

set term wxt enhanced 
cd 'working directory' 
unset key 

set size 0.9,0.9 
set origin 0.1,0.1 
set title 'TITLE' 

unset border 
set label 21 " rotate by 45" at -3.0,0.0 rotate by 45 point ps 2 

set xrange [0:19.519] 
set yrange [110:119] 
set xtics nomirror(0, 2.745, 4.054, 6.131, 7.7, 8.391, 10.535, 11.433, 12.591, 19.519) rotate by 90 offset 0,-0.1 right 

set ytics "  ", 30000 

plot "line1.dat" using ($1):($2):2 with labels offset 1, 1.8 rotate by 90, "line1.dat" using 1:2 with lines lt 1 lw 1 lc rgb '#000000', +112 lt 1 lw 1 lc rgb '#000000' , 'test.dat' with lines lt 1 lw 1 lc rgb '#000000', +110 lt 1 lw 1 lc rgb '#000000', 'line2.dat' with lines lt 0.5 lw 1 lc rgb '#000000', 'test2.dat' with lines lt 0.5 lw 1 lc rgb '#000000' 

回答

0

您可以手動測量距離。將鼠標移至第一個點並鍵入'r'。然後,當您移動鼠標時,會顯示x和y偏移,距離和角度。鍵入'5'繪製一條線段並在度和切線顯示之間切換。事先放大可提高準確性。

順便說一句,鍵入繪圖窗口「H」將顯示鍵綁定到控制檯的列表。