gnuplot 忽略 csv 列值的除数
我正在使用 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 文件,是的,但是它们很多,而且我必须编写一个脚本来更改所有单元格,我绝对不喜欢这样做。
I am using gnuplot to draw a histogram of a series of RAM measurements I performed.
However, I want it to display the values that are stored in Bytes in CSV files in KB.
I divided the respective columns by 1024, but gnuplot simply ignores that.
Below you see the template that is changed by a script to have meaningful file names for CSVFILE
and PSFILE
and then fed into 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
So what does not work is the /1024
. Any ideas how to do that?
Changing the CSV files instead came to my mind, yes, but they are a lot, and I would have to write a script to change all cells, which I definitely do not fancy to do.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,解决方案很简单。我只需将
$2
值括在额外的大括号中,例如($2)/1024
。Okay, the solution was trivial. I just had to enclose the
$2
values in extra braces, like($2)/1024
.