-----编辑-----添加了样本数据和完整的简化python代码,产生了相同的错误。
在我的大约三分之一的图中,我使用相同的代码但不同的数据生成了一个偏斜的数据点。据我所知,数据点只在10,x(我的第二行数据)处失败,在我今天看到的每个错误情况下给出一个点(10,3)(大约10) ,并且没有数据文件具有(10,3)作为数据点。我现在上传一张照片,但我是新用户(需要更多帖子)。
错误输出的代码,它通过python传递,但保留了gnuplot语法:
import os
D1='data_from_below.csv'
PLOTFILE='ALA1_STDEVP.png'
f=os.popen('gnuplot' ,'w')
print >>f, "set datafile separator ','"
print >>f, "plot '%s' u 1:2" % (D1)
print >>f, "ymax=GPVAL_DATA_Y_MAX"
print >>f, "ymin=GPVAL_DATA_Y_MIN"
print >>f, "ylen=ymax-ymin"
print >>f, "xmax=GPVAL_DATA_X_MAX"
print >>f, "xmin=GPVAL_DATA_X_MIN"
print >>f, "xlen=xmax-xmin"
print >>f, "set xrange [xmin:xmax]"
print >>f, "set yrange [ymin-0.5*ylen:ymax+0.5*ylen]"
print >>f, "set nokey"
print >>f, "set title 'STDEVP for ALA 1 of 3KYX'"
print >>f, "set xlabel 'Rotation angle'; set ylabel 'Electron Density'"
print >>f, "f(x) = mean_y; fit f(x) '%s' u 1:2 via mean_y" % (D1)
print >>f, "stddev_y = sqrt(FIT_WSSR / (FIT_NDF + 1 ))"
print >>f, "set label 1 gprintf('Mean = %g', mean_y) at 3, ymin-0.2"
print >>f, "set label 2 gprintf('Standard deviation = %g', stddev_y) at 2, ymax+0.2"
print >>f, "plot mean_y-(stddev_y) with filledcurves y1=mean_y lt 1 lc rgb '#bbbbdd' title 'booo', mean_y+(stddev_y) with filledcurves y1=mean_y lt 1 lc rgb '#bbbbdd', mean_y w l lt 3, '%s' u 1:2 w p pt 7 lt 1 ps 1" % (D1)
print >>f, "set terminal png large size 750,500; set out '%s'" % (PLOTFILE)
print >>f, "replot"
f.flush()
不产生错误的简化代码:
import os
D1='data_from_below.csv'
PLOTFILE='ALA1_errorcheck.png'
f=os.popen('gnuplot' ,'w')
print >>f, "set datafile separator ','"
print >>f, "set nokey"
print >>f, "plot '%s' u 1:2" % (D1)
print >>f, "set terminal png large size 750,500; set out '%s'" % (PLOTFILE)
print >>f, "replot"
f.flush()
SAMPLE DATA,.csv格式:
3KYX_ALA_A_1,3KYX_ALA_A_16
0,1.770
10,1.933
20,2.042
30,2.184
40,2.441
50,2.629
60,2.756
70,2.849
80,2.699
90,2.549
100,2.206
110,1.827
120,1.571
130,1.438
140,1.326
150,1.346
160,1.491
170,1.648
180,1.690
190,1.754
200,1.674
210,1.487
220,1.318
230,1.189
240,1.020
250,0.960
260,1.008
270,1.151
280,1.373
290,1.620
300,1.733
310,1.851
320,1.933
330,1.981
340,1.870
350,1.775