2016-09-21 81 views
1

在gnuplot的4.6以下的一段代碼控制pointtype工作:第三符號和第四符號:在gnuplot的5.0與串

tip="3 4" 
plot for [i=1:2] sin(x*i) w point pointtype word(tip,i)+0 

每條曲線與對應點的符號標繪。注意'+0'將單詞轉換爲數字。

在gnuplot 5.0中,同一段代碼失敗。它會顯示曲線'1'(在第一次迭代中)和'2'(在第二次中)。

爲什麼?這樣可以在gnuplot 5.0中控制點類型嗎?

回答

0

在gnuplot 5中,爲pointtype提供的參數解析已經改變,因爲現在可以繪製字符點符號(請參閱第http://gnuplot.sourceforge.net/demo/lines_arrows.html處的第三個示例)。我想這會引入你所看到的錯誤。

使用int(word(tip, i)),讓您的工作例如:

tip="3 4" 
plot for [i=1:2] sin(x*i) w point pointtype int(word(tip,i)) 
+0

它的工作,謝謝。我記得花了一些時間學習如何將字符串轉換爲數字,以便字(字符串,i)可以工作。 「+0」得到了4.6的東西。現在int(word())看起來很可愛。 – jmmo