有了RedHat和Gnuplot 4.6,我有了这些数据:
2019-08-30,384.00,225.3
2019-08-31,394.00,225.3
2019-09-01,406.00,225.3
2019-09-02,424.00,225.3
2019-09-03,439.00,225.29
2019-09-04,454.00,234.34
2019-09-05,484.00,234.34
这个脚本:
set title "test"
set terminal png truecolor size 960,720 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/xxx/test.png"
set grid
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set style line 2 \
linecolor rgb "red" \
linetype 1 linewidth 1 \
pointtype 7 pointsize 1
set offsets 0.5,0.5,0,0.5
set datafile separator ","
set format y "%g"
set key left
myLabel(n) = sprintf("%g",n)
plot "df_output.txt" using 2:xtic(1) with linespoints linestyle 1 ,\
'' using 3:xtic(1) with linespoints linestyle 2 title " Free space ", \
'' using 0:2:(myLabel($2)) w labels offset 0,-0.5 notitle, \
'' using 0:3:(myLabel($3)) w labels offset 0,1 notitle, \
我想在蓝色曲线上放置一条趋势线,所以我的脚本看起来像:
set title "test"
set terminal png truecolor size 960,720 background rgb "#eff1f0"
set output "/xxx/xxx/xxx/xxx/test.png"
set grid
set style line 1 \
linecolor rgb '#0060ad' \
linetype 1 linewidth 2 \
pointtype 7 pointsize 1.5
set style line 2 \
linecolor rgb "red" \
linetype 1 linewidth 1 \
pointtype 7 pointsize 1
set offsets 0.5,0.5,0,0.5
set datafile separator ","
set format y "%g"
set key left
myLabel(n) = sprintf("%g",n)
f(x) = a*x + b
fit f(x) "df_output.txt" u 0:2 via a,b
plot "df_output.txt" using 2:xtic(1) with linespoints linestyle 1 ,\
'' using 3:xtic(1) with linespoints linestyle 2 title " Free space ", \
'' using 0:2:(myLabel($2)) w labels offset 0,-0.5 notitle, \
'' using 0:3:(myLabel($3)) w labels offset 0,1 notitle, \
f(x) w l lc "black" title "trendline"
在没有f函数和相同数据的情况下,此脚本与AIX 7.2完美配合,但是与f函数一起,我的error_log文件中存在此错误:
Could not open log-file fit.log:
如果我尝试手动生成图形,则会出现此错误:
Singular matrix in Invert_RtR
"gnuplot_script.txt", line 25:
第25行是:
fit f(x) "df_output.txt" u 0:2 via a,b
你对这个问题有任何想法吗?