2013-07-18 115 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”将显示键绑定到控制台的列表。