我正在尝试使用 gnuplot 重新创建我在 MS Excel 中创建的图。这可以在显示具有相应回归系数的功率趋势线方程的 gnuplot 中完成吗?必须绘制的数据来自文件:'data.txt','x' 的数据来自第 10 列,'y' 来自第 11 列。谢谢!
问问题
3890 次
1 回答
1
我设法制作了上述 excel 图的工作版本。然而,任何改进都受到高度赞赏。谢谢。我在 gnuplot 中的代码是
set terminal svg enhanced fname "Times-New-Roman,12"
set xlabel "x"
set ylabel "y"
set xrange [0:*]
set yrange [0:*]
set format x "%0.3f"
set format y '%0.3f'
set title sprintf("y=f(x)")
# plot
filename="data.txt"
plotfile="out.svg"
set output plotfile
f(x)=a*x**b
fit f(x) filename using 10:11 via a,b
set label GPFUN_f at graph .15,.95
set label sprintf("a = %g",a) at graph .15,.90
set label sprintf("b = %g",b) at graph .15,.85
plot filename using 10:11 title "y(x)" with points pointtype 1 pointsize 1,\
f(x) title "power-trendline" with line linewidth 2
![power-trendline-gnuplot]
于 2013-05-13T05:25:40.597 回答