我正在使用 gnuplot 绘制我执行的一系列 RAM 测量的直方图。但是,我希望它以 KB 为单位显示存储在 CSV 文件中的字节中的值。我将各个列除以 1024,但 gnuplot 只是忽略了这一点。
在下面,您会看到由脚本更改为具有有意义的文件名的模板,CSVFILE
然后PSFILE
将其输入 gnuplot。
set style data histogram
set style histogram errorbars gap 1
set xlabel "nodes"
set ylabel "memory (KB)"
set key left box
set datafile separator ","
set terminal postscript landscape
set output 'PSFILE'
plot 'CSVFILE' using ($2/1024):($3/1024):xtic(1) ti col lt -1 fs pattern 1,\
'' using ($4/1024):($5/1024):xtic(1) ti col lt -1 fs pattern 2,\
'' using ($6/1024):($7/1024):xtic(1) ti col lt -1 fs pattern 4,\
'' using ($8/1024):($9/1024):xtic(1) ti col lt -1 fs pattern 6,\
'' using ($10/1024):($11/1024):xtic(1) ti col lt -1 fs pattern 5,\
'' using ($12/1024):($13/1024):xtic(1) ti col lt -1 fs pattern 7,\
'' using ($14/1024):($15/1024):xtic(1) ti col lt -1 fs pattern 3
所以不起作用的是/1024
. 任何想法如何做到这一点?
我想到了更改 CSV 文件,是的,但它们很多,我必须编写一个脚本来更改所有单元格,我绝对不想这样做。