函数未处理 Gnuplot 标签

丹尼尔·格雷

我有以下rule_times.dat文件:

0 min 4246
0.5 min 26543
1.5 max 38339128
2 max 7293253
3 avg 103698.380554429
3.5 avg 43305.9820981295

以及以下gnuplot脚本:

reset
set style line 1 lc rgb "#c42f27"
set style line 2 lc rgb "#2f27c4"
set terminal png
set boxwidth 0.5
set style fill solid

set xtics("min" 0.25, "max" 1.75, "avg" 3.25)

set ylabel "log(time for 1000 evaluations)"
set ytics 10000
set yrange [0:25]

to_us(x)=floor(x/1000)
set title "Evaluation times for direct rule evaluation"

plot "rule_times.dat" using 1:(log($3)):(to_us($3)) with labels offset character 0, character 1 tc rgb "black" title "", \
    "rule_times.dat" every 2 using 1:(log($3)) with boxes ls 1 title "log(eval)", \
    "rule_times.dat" every 2::1 using 1:(log($3)) with boxes ls 2 title "log(lookup)"

并且正在获得以下输出: 阴谋

我希望将数字除以 1000 并进行四舍五入/地板化/无论如何,以便条形顶部的标签是较小的数字,但该功能似乎未应用!我错过了什么?

迈杰

该表达式floor(x/1000)返回一个必须转换为字符串的数字。一些想法:

通过将结果附加到空字符串进行隐式转换:

to_us(x)="".floor(x/1000)

可能更灵活的显式转换:

to_us(x)=sprintf("%6.2f", (x/1000))

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章