2012-03-03 39 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