2012-05-01 26 views
3

我发现,在gnuplot的可以获得多条曲线/数据集从单个文件:如何在单个绘图命令的gnuplot命令脚本中嵌入多个数据集?

splot "file.dat" using 1:2:3, splot "file.dat" using 1:4:5 

另外一个可以在脚本中嵌入数据,像这样:

splot "-" using 1:2:3 
1 0 1 
1 2 3 
0.5 3 1.5 

然而,以下似乎不工作:

splot "-" using 1:2:3, "-" using 1:4:5 
1 0 1 4 4 
1 2 3 3 4 
0.5 3 1.5 2.5 -1 

这是故意的,是否存在解决方法或者是不可能的?

回答

4

以下脚本可按预期与Gnuplot 4.4一起使用。连接输出下面

set terminal png 
set output 'e.png' 
splot "-" using 1:2:3, "" using 1:2:3 
1 0 1 4 4 
1 2 3 3 4 
0.5 3 1.5 2.5 -1 
e 
1 4 4 
1 3 4 
0.5 2.5 -1 
e 
set output 

splot "-" using 1:2:3, "" using 1:2:3

1

的解决办法是

splot "-" using 1:2:3 
1 0 1 
1 2 3 
0.5 3 

splot "-" using 1:2:3 
1 4 4 
1 3 4 
0.5 2.5 -1 

如果你可以把5列数据为plotscript,你可以它进行预处理是两个3列数据集在plotscript。

我不能像你试过的那样使它在一行中工作。这是不可能的,因为

splot 'dat.txt' using 1:2:3, '' using 1:3:4 

作品,但

splot '-' using 1:2:3, '' using 1:4:5 
1 0 1 4 4 
1 2 3 3 4 
0.5 3 1.5 2.5 -1 

没有。

3

的Gnuplot 5.0.1数据块工作做好为:

$data << EOD 
1 0 1 4 4 
1 2 3 3 4 
0.5 3 1.5 2.5 -1 
EOD 

splot "$data" using 1:2:3, "$data" using 1:4:5 

的Ubuntu 14.04安装:

cvs -d:pserver:[email protected]:/cvsroot/gnuplot login 
cvs -z3 -d:pserver:[email protected]:/cvsroot/gnuplot co -P gnuplot 
cd gnuplot 
cvs update -r Release_5_0_1 
sudo apt-get build-dep gnuplot 
sudo apt-get install lua5.2 
./prepare 
./configure 
time make 
sudo make install 
gnuplot --version 

15.04有gnuplot5-x11包。

+0

你能解释第一行:'$ data << EOD'。你为什么从EOD开始?我没有在文档中找到它。 –

+0

@JorisKinable只是一种神奇的语法来内联否则会在文件中的数据。来自shell heredocs的语法。另请参阅gnuplot 5.0.1中的'help datablock'。 –

相关问题