2017-11-18 118 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