使用输入文件中的最后日期值作为 gnuplot 中的标签文本
Using last date value from input file as label text in gnuplot
我有一些来自文件的输入数据,如下所示:
06.03.2020 62,30
09.03.2020 60,16
10.03.2020 59,94
11.03.2020 59,34
12.03.2020 56,58
13.03.2020 56,37
我可以按照自己的意愿绘制数据,但由于输入数据和生成的图表会自动更新,我想通过打印来显示图表和输入数据的最新状态第 1 列的最后一个值作为图表中的标签。
到目前为止,我已经尝试过类似
的方法
set term unknown
plot [:][:] input.txt using (xlast=):2
set terminal qt
set label xlast at graph 0.025, graph 0.95 left
plot ...
但我没能得到图表的输出。
有人可以帮我吗?
谢谢
尝试使用strcol(1)
,我猜</code>尝试提取一个数字。</p>
<p><strong>代码:</strong></p>
<pre><code>### last value of column to label
reset session
$Data <<EOD
06.03.2020 62,30
09.03.2020 60,16
10.03.2020 59,94
11.03.2020 59,34
12.03.2020 56,58
13.03.2020 56,37
EOD
set table $Dummy
plot $Data u (LastX=strcol(1)) w table
unset table
set label LastX at graph 0.025, graph 0.95 left
plot $Data u 0:(rand(0)) w l notitle
### end of code
结果:
我有一些来自文件的输入数据,如下所示:
06.03.2020 62,30
09.03.2020 60,16
10.03.2020 59,94
11.03.2020 59,34
12.03.2020 56,58
13.03.2020 56,37
我可以按照自己的意愿绘制数据,但由于输入数据和生成的图表会自动更新,我想通过打印来显示图表和输入数据的最新状态第 1 列的最后一个值作为图表中的标签。
到目前为止,我已经尝试过类似
的方法set term unknown
plot [:][:] input.txt using (xlast=):2
set terminal qt
set label xlast at graph 0.025, graph 0.95 left
plot ...
但我没能得到图表的输出。 有人可以帮我吗?
谢谢
尝试使用strcol(1)
,我猜</code>尝试提取一个数字。</p>
<p><strong>代码:</strong></p>
<pre><code>### last value of column to label
reset session
$Data <<EOD
06.03.2020 62,30
09.03.2020 60,16
10.03.2020 59,94
11.03.2020 59,34
12.03.2020 56,58
13.03.2020 56,37
EOD
set table $Dummy
plot $Data u (LastX=strcol(1)) w table
unset table
set label LastX at graph 0.025, graph 0.95 left
plot $Data u 0:(rand(0)) w l notitle
### end of code
结果: