2017-11-18 13 views
0

我有以下數據項:gnuplot的:格式YAXIS在10^x的

y, x 
1, 8.0    
10, 3.6    
100, 3.36    
1000, 3.212     
10000, 3.152    
100000, 3.14316    
1000000, 3.14266   
10000000, 3.1420448   
100000000, 3.14190876 
1000000000, 3.141573084 

,我試圖在10^x

術語格式y軸上pi的 Ñ計算值我用下面的代碼:

set terminal pngcairo size 1280,800 enhanced font 'Helvetica,24' 
set output "fig.png" 

# Title, axis label, range and ticks 
set title "Simulations" 
set xlabel "Number of Iterations(n)" 
set ylabel "Computed values" 

# Legend location and grid 

set key top left 
set grid 
set ytics out nomirror 
set xtics out nomirror 
set format y "10^{%L}" 


# Plot the data 
plot data.dat" using 2:1 title "" with linesp lw 2 pt 7 ps 1.5 

但我得到以下的輸出:

enter image description here

請幫

感謝

回答

2

我猜你真正想要的,因爲有一些不一致的地方。這是我相信給你帶來你想要的地方,改變在源文件中的評論。

# Title, axis label, range and ticks 
set title "Simulations" 
set xlabel "Number of Iterations(n)" 
set ylabel "Computed values" 

# Legend location and grid 

set datafile separator comma # gnuplot looks for spaces 
           # you must tell it about the comma 
unset key      # same as title "" as you have in your plot command 
set grid 
set ytics out nomirror 
set xtics out nomirror 
set logscale x    # I guess that's what you want and how it should be 
set format x "10^{%L}"  # yr x axis is labeled iterations, so I guess 
           # that's what you want 

# Plot the data 
plot [][2:10] "data.dat" using 1:2 with linesp lw 2 pt 7 ps 1.5 
    # swapped 2:1 so that the iterations are on the x axis 
    # introduced a range for y so that it is better to see 
    # 'title ""' removed, see 'unset key' 

這給你

enter image description here

可能不是你想要什麼,但你應該移動到一個新的水平,我希望。

+0

非常感謝,它效果很好。 – Learner27