我想要一个存储数据和gnuplot命令的.plt文件.我的数据看起来像
# x1 y1 x2 y2
1 2 3 4
5 6 7 8
Run Code Online (Sandbox Code Playgroud)
并且对应于两个图:(x1,y1)和(x2,y2).
我知道我可以使用"-":
plot "-" using 1:2
# x1 y1 x2 y2
1 2 3 4
5 6 7 8
e
Run Code Online (Sandbox Code Playgroud)
但这只会产生一个图,即(x1,y1).我正在尝试做类似的事情
plot "-" using 1:2, "-" using 3:4
# x1 y1 x2 y2
1 2 3 4
5 6 7 8
e
Run Code Online (Sandbox Code Playgroud)
但显然这不起作用,因为gnuplot期望第二个标准输入的一组新数据"-".
笔记:
reread但需要两个文件.我真的只想要一个文件.我知道如何使用$与using在类似的例子
plot datafile using f($1):g($2)
Run Code Online (Sandbox Code Playgroud)
绘制列数据的功能.但我想在循环中使用此功能:
plot for [c=1:10] datafile using f($(c)):g($(c+1))
Run Code Online (Sandbox Code Playgroud)
当然这段代码不起作用.我想如果我知道如何将整数c转换为字符串(或单个ASCII字符),那么它将起作用.有谁知道怎么做?
[如果可以在不将整数转换为字符串的情况下完成相同的任务,那也没关系.]
gnuplot ×2