函数未处理Gnuplot标签
我有以下函数未处理Gnuplot标签,gnuplot,Gnuplot,我有以下rule\u 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.
rule\u 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))
另请参见和sourceforge上的链接讨论。使用
x/1000
还是x/1000.0`会有区别吗?我遇到过整数除法的情况。。。