使用for循环绘制gnuplot中列中数字的倒数 [英] Plotting the inverse of the numbers in columns in gnuplot with for loop
本文介绍了使用for循环绘制gnuplot中列中数字的倒数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
plot for [i = 1:30]'file'using 1:(1 / i)w lp
所有的y值都是零。当我删除for循环,并选择一个列来绘制: p'file'u 1:(1 / $ 4)
。我在做什么不正确?
解决方案
在括号里面 i
是只有一个整数,你总是零。要访问表达式中的列的值,使用列(i)
:
使用1:(1 / column(i))w lp
$ b $为[i = 1:30] b
$ 4
是列(4)
的快捷键。为了更好地理解这一点,看一看
i = 2
plot'file'u 1:i,' '你1:(i)
I want to plot the inverse of the numbers in a number of columns against the first column:
plot for [i=1:30] 'file' using 1:(1/i) w lp
which results in all the y values to be zero. It works when I remove the for loop and just pick a column to plot: p 'file' u 1:(1/$4)
. What am I doing incorrectly?
解决方案
Inside the parentheses the i
is only an integer number, and you get always zero. To access the value of a column inside an expression, use column(i)
:
plot for [i=1:30] 'file' using 1:(1/column(i)) w lp
The $4
is a shortcut for column(4)
. To understand this better, have a look at
i = 2
plot 'file' u 1:i, '' u 1:(i)
这篇关于使用for循环绘制gnuplot中列中数字的倒数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文