2013-05-16 39 views
0

我知道我可以用stdin的數據作爲數據源繪製數據,但是有什麼辦法可以用同樣的方法繪製命令的數據輸出?也就是說,我可以在gnuplot腳本本身指定命令,而不是運行gnuplot腳本的命令和管道。Gnuplot:來自命令的繪圖數據

是這樣的(但這不工作):上述

set terminal pngcairo 
set output 'test.png' 

cmd = "`./mycmd`" # running ./mycmd in terminal gives my data to stdout. 
        # the command can be several other commands, piped together. 
        # i'm only interested in whatever comes to stdout after running 
        # the entire thing. 

plot cmd u 2:3 w lines # etc... 

使得cmd包含具有搗爛一起輸出的所有行的單個長行。

回答

2

是的,你可以:

plot '< ./mycmd' 
+0

輝煌!它總是比你想象的更容易=) –

+0

@TomasLycken:它應該工作。也許你的數據(標題)的第1行有錯誤? – choroba

+0

我再次嘗試從文件中重定向和繪圖,出於某種原因它現在不起作用 - 這就是爲什麼我刪除了我的評論。將進一步調查... –