开发者

gnuplot ignores divisor of csv-column values

开发者 https://www.devze.com 2023-01-14 04:23 出处:网络
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 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开发者_如何学Python "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.


Okay, the solution was trivial. I just had to enclose the $2 values in extra braces, like ($2)/1024.

0

精彩评论

暂无评论...
验证码 换一张
取 消