2013-03-11 57 views
0

我正在GNUPLOT中繪製一個多槽圖,爲了節省空間,我只在一個圖上繪製了軸標籤。對於其他的情節,我使用GNUPLOT可以動態準備索引標籤嗎?

set ytics ("" -20, "" -15, "" -10, "" -5, "" 0, "" 5, "" 10, "" 15, "" 20) 

對於一個小規模的這樣的,手動的可行改寫抽動的標籤。我可以使用內置的gnuplot(for-loop)來動態編寫這個「範圍」嗎?

回答

3

是的,你可以,喜歡的東西

numtics = 8 

set macros 

ticstring = '(' 

do for [i=0:numtics] { 
    ticstring = ticstring.'"" '.(-20 + i*5).', ' 
} 

ticstring = ticstring.'"" 20)' 

set ytics @ticstring 

什麼可以在你的情況是簡單的將是命令

set ytics format "" 5 

這將給抽動每5與一個空白標籤。

+0

我的例子只是一個簡單的案例來說明這個想法。 – TMOTTM 2013-03-11 13:06:33

2

我認爲這是MUCH容易只是像做:

set multiplot layout 1,2 

set xtics format "" #no x-tic labels on the top plot 
plot sin(x)   #top plot 

set xtics format "%g" #x-tic labels on the bottom plot 
plot cos(x)   #bottom plot 

unset multiplot 
+0

這確實是一個很好的觀點。我的問題部分是爲了理解gnuplot中的for-loop如何工作,我需要一個真實的例子。 – TMOTTM 2013-03-13 09:51:31