2012-03-03 38 views
0

我有以下代码:管道到GNUPLOT,不接受多个命令

fprintf(temp->_fstream, "plot '-' using 1:2 title 'tittle1'\n"); 

_fstream是gnuplot的管,使用“ - ”使得能够将数据写入GNUPLOT直接而不是先写它到文件,这是做的代码:

fprintf (_stream->_fstream, "%d ", _node->count); 

现在我想绘制另一个两列说1:3,例如在gnuplot的,你会使用这样做:

plot "output3.txt" using 1:2 title 'prey', "output3.txt" using 1:3 title 'predator' 

,但通过它给出了一个错误说unreachable data source这里的管道做同样的事情是,我使用的线:

fprintf(temp->_fstream, "plot '-' using 1:2 title 'tittle1', '-' using 1:3 ... \n"); 

我一直在看这一段时间的任何帮助,将不胜感激。

+0

您可能需要创建一个伪TTY,使gnuplot的行为,如果是在交互模式。 – 2012-03-03 23:25:02

回答

0

尝试:

plot '-' us 1:2, '' us 1:2

并输入(或写入到流),随后的 'e' 的数据。 然后,输入第二组数据,然后输入'e'。

1 1 
2 2 
3 3 
e 
1 2 
2 3 
3 4 
e 
+0

感谢您的答复,是的,我想我将不得不重新输入数据,上面的行不起作用,唯一的问题是数据是> 10,000,所以重新输入它将是昂贵的。 – mihajlv 2012-03-04 03:56:09