gpt4 book ai didi

gnuplot - 计算线之间的距离

转载 作者:行者123 更新时间:2023-12-01 03:55:25 25 4
gpt4 key购买 nike

gnuplot 可以计算两条线或两点之间的距离吗?

我有一个情节,其中绘制了两条(主)线。目前让我们假设第一行总是在第二行之上。有没有办法在给定的 x 值处计算从第 2 行到第 1 行的距离?

这是我的情节的样子以及我要计算的距离的图片:

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

竖线只是样式,与实际绘图无关,它们的数据存储在test.dattest2.dat .

我的行数据文件如下所示:
第 1 行

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'

最佳答案

您可以手动测量距离。将鼠标移动到第一个点并输入“r”。然后当您四处移动鼠标时,会显示 x 和 y 偏移量、距离和角度。键入“5”以绘制线段并在度数和切线显示之间切换。预先放大可提高准确性。

顺便说一句,在绘图窗口中键入“h”将显示控制台的键绑定(bind)列表。

关于gnuplot - 计算线之间的距离,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17717287/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com