Den*_*nis 5 gnuplot input function
我想知道Gnuplot是否有一些解决方法来交换类似的内容
plot input.dat using ($1/2):($2*2) axis x1y1 w lp
Run Code Online (Sandbox Code Playgroud)
同
plot input.dat using func1($1,$2):func2($1,$2) axis x1y1 w lp
Run Code Online (Sandbox Code Playgroud)
同
func1(x,y) = x/2; func2(x,y) = y*2;
Run Code Online (Sandbox Code Playgroud)
?
我想在绘图之前对输入数据(线)进行后期处理.
你可以使用非常接近你建议的语法.定义这样的函数:
func1(x) = x / 2
func2(x) = x * 2
Run Code Online (Sandbox Code Playgroud)
并像这样使用它们:
plot "input.dat" using (func1($1)):(func2($2))
Run Code Online (Sandbox Code Playgroud)
情节陈述中的那个括号结是必要的.
您可以定义多个变量的函数:
func3(x, y) = x * y
Run Code Online (Sandbox Code Playgroud)
这些用法类似:
plot "input.dat" using (func1($1)):(func3($1, $2))
Run Code Online (Sandbox Code Playgroud)