【问题标题】:gnuplot ignores divisor of csv-column valuesgnuplot 忽略 csv 列值的除数
【发布时间】:2010-09-03 21:01:36
【问题描述】:

我正在使用 gnuplot 绘制我执行的一系列 RAM 测量的直方图。 但是,我希望它以 KB 为单位显示存储在 CSV 文件中的字节中的值。 我将各个列除以 1024,但 gnuplot 只是忽略了这一点。

您会看到下面的模板被脚本更改为具有CSVFILEPSFILE 的有意义的文件名,然后输入到 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 文件,是的,但它们很多,我必须编写一个脚本来更改所有单元格,我绝对不想这样做。

【问题讨论】:

    标签: csv gnuplot


    【解决方案1】:

    好的,解决方案很简单。我只需将$2 值括在额外的大括号中,例如($2)/1024

    【讨论】:

      猜你喜欢
      • 2011-12-14
      • 1970-01-01
      • 1970-01-01
      • 2011-03-15
      • 2012-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-06-10
      相关资源
      最近更新 更多