gpt4 book ai didi

plot - GnuPlot 中的线图,其中线宽是我的数据文件中的第三列?

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

我有一个包含三列的数据文件:

1 1.0 1
2 1.5 2
3 0.0 3
4 1.2 2.5
5 1.0 1
6 1.1 5

其中第一列是我的 X 值,第二列是我的 Y 值,第三列是线宽。我希望根据第三列线宽绘制每个线段。

我试过:
plot 'file1.dat' using 1:2:3  with lines lw var

但我得到 undefined variable :var 错误。

这在 gnuplot 中可能吗?

谢谢。

最佳答案

如果您将第 3 列定义为点 n 和 n+1 之间的线宽(因此该行的第 3 列的值将被忽略),您可以作弊:

stat 'file1.dat'
n=STATS_records
plot for [i=0:0] 'file1.dat' using 1:2:(alma=$3) every ::i::i w l lc 1 lw 1
plot for [i=0:n-1] 'file1.dat' using 1:2:(alma=$3) every ::i::i+1 w l lc 1 lw alma notitle

或者
plot 'file1.dat' u 0:1
n=GPVAL_DATA_X_MAX
plot for [i=0:0] 'file1.dat' using 1:2:(alma=$3) every ::i::i w l lc 1 lw 1
plot for [i=0:n] 'file1.dat' using 1:2:(alma=$3) every ::i::i+1 w l lc 1 lw alma notitle

enter image description here

您需要第一个 plot for[i=0:0] '初始化'变量'alma'。

关于plot - GnuPlot 中的线图,其中线宽是我的数据文件中的第三列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37925489/

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