Gnuplot:处理异常结果

Gnuplot:处理异常结果,gnuplot,Gnuplot,我在Windows8机器上使用gnuplot版本4.6,补丁级别3,终端设置为wxt 文件results.csv具有随球体半径变化的能量列表。我正在使用Gnuplot生成一个图表,以显示趋势 不幸的是,由于用于计算这些能量的程序中只能描述为“数值不稳定性”,results.csv包含异常结果。因此,plotting results.csv具有: set datafile separator “,” set title “Oxygen3 Point Vacancy Defect Energy Va

我在Windows8机器上使用gnuplot版本4.6,补丁级别3,终端设置为wxt

文件results.csv具有随球体半径变化的能量列表。我正在使用Gnuplot生成一个图表,以显示趋势

不幸的是,由于用于计算这些能量的程序中只能描述为“数值不稳定性”,results.csv包含异常结果。因此,plotting results.csv具有:

set datafile separator “,”
set title “Oxygen3 Point Vacancy Defect Energy Variation with \n Radius of Region I in Mott-Littleton Defect Model”
set xlabel ‘Radius of Region I (Å)’
set ylabel ‘Defect Energy (eV)’
set grid
unset key
set border 3
set xtics border nomirror outwards
set ytics border nomirror outwards
set format y '%.2f'
plot ‘results.csv’ using 2:4 smooth unique with linespoints lw 3 lc rgb ‘black’
给出以下图表:

[N.B.我已经减少了本例的数据线数量]

由于我想要整体趋势,我想跳过半径=16的点。但是,将“打印”命令更改为:

plot 'results.csv' using 2: ($4 > 20 ? $4 : 1/0) smooth unique with linespoints lw 3 lc rgb 'black'
结果:

有没有人对是什么让gnuplot将x=9点连接到x=17以及如何克服这个问题有什么建议

此外,当我尝试拟合“最佳拟合线”时,如何跳过异常数据点

如果在绘图时忽略异常点,将不胜感激 原则上,
gnuplot
knowns

  • 缺失
    点,可使用
    设置数据文件缺失
    进行设置。这些点在打印过程中被跳过,不会影响线打印
  • 未定义的
    点,如
    1/0
    。这些点也会被跳过,但是直线图在这里会被打断
  • 不幸的是,当涉及计算(如您案例中的过滤)时,无法使用缺少的数据点,请参见例如

    因此,最好的方法是使用外部工具过滤数据:

    plot '< awk ''{ if ($4 > 20) print }'' results.csv' using 2:4 smooth unique
    
    关于
    设置输出
    部分,请参阅

    set output '| head -n -2 > results.tmp'
    set table
    plot '< awk ''{ if ($4 > 20) print }'' results.csv' using 2:4 smooth unique
    unset table