用于数据平滑的gnuplot数据插值方法

用于数据平滑的gnuplot数据插值方法,plot,matplotlib,gnuplot,Plot,Matplotlib,Gnuplot,朋友们,我有大量的数据要用gnuplot打印在图形上。 由于图形中的点数太大,我使用cspline数据插值方法来平滑数据。但是插值方法跳过了一些异常值,这在程序性能分析中可能很重要。我应该如何确保gnuplot函数不会遗漏极端异常值(相差超过x的值) 下面是我用来生成绘图的代码 plot data_file binary format='%uint64 %double %double %double' using 1:2 smooth csplines title "Kernel hit-rat

朋友们,我有大量的数据要用gnuplot打印在图形上。 由于图形中的点数太大,我使用cspline数据插值方法来平滑数据。但是插值方法跳过了一些异常值,这在程序性能分析中可能很重要。我应该如何确保gnuplot函数不会遗漏极端异常值(相差超过x的值)

下面是我用来生成绘图的代码

plot data_file binary format='%uint64 %double %double %double' using 1:2 smooth csplines title "Kernel hit-rate"  with lines, \ 
 data_file binary format='%uint64 %double %double %double' using 1:3 smooth csplines title "User hit-rate"    with lines, \
 data_file binary format='%uint64 %double %double %double' using 1:4 smooth csplines title "Overall hit-rate" with lines   
生成的图表如下所示:


我希望gnuplot仅在点不太远(可配置参数)时平滑点??您还可以推荐任何其他可以满足我要求的绘图工具吗???

您可能可以使用shell magic和
set table的组合来实现这一点。例如:

set samples 200 #How many points will be used in interpolating the data...
YLIMIT=.5  #for example
set table 'junkfile1.dat'  #This holds the "smooth" portion
plot 'data_file' binary format='%uint64 %double %double %double' using 1:($2<YLIMIT ? $2: 1/0) smooth csplines
unset table                #This holds the "spurious" portion
set table 'junkfile2.dat'
plot 'data_file' binary format='%uint64 %double %double %double' using 1:($2>YLIMIT ? $2: 1/0)
unset table

plot '< sort -n -k 1 junkfile1.dat junkfile2.dat' u 1:2 with lines 
!rm junkfile1.dat junkfile2.dat  #cleanup after ourselves
set samples 200#插值数据时将使用多少个点。。。
例如,YLIMIT=.5
设置表格“junkfile1.dat”#该表格包含“平滑”部分
使用1:($2YLIMIT?$2:1/0)打印“数据文件”二进制格式=“%uint64%double%double%double”
未设置的表
用线条绘制“

(未经测试)

请不要讨论图的语义。我很困惑,第一个图有csplines,第二个图没有csplines?如果是这样的话,您想用csplines实现什么(即第二个图形有什么问题?)(1)第一个图形是csplines,第二个部分没有csplines。(2) 正如您所注意到的,在第二个图表中,我们可以看到一些Y值达到0.8到0.9。不幸的是,第一个图形的x范围峰值(5000)约为0.1,但第二个图形有什么问题?如果你想保持虚假的峰值,那么使用csplines似乎与你想要实现的恰恰相反作为旁注,可以使用
set samples N
来增加采样频率,这可能会使第一个图形看起来更像第二个图形(具有相当大的N)……此外,gnuplot还有多种平滑选项:来自内置帮助:`smooth'{唯一|频率|累积| K密度| Cslines | AcSpline | bezier | sbezier}`--您可以尝试其他方法,看看效果如何。问题是排序和其他函数仅在ascii数据上工作,而在二进制日不工作。我正在尝试修改图形格式并使用上面列出的代码进行检查。您是指
plot'吗?我尝试了上述方法。它适用于小输入,但对于大输入,它会崩溃表格内存不足错误。哇,你真的必须有很多数据点(或少量内存)。我想你应该问的问题是,你真的需要那么多数据吗?一旦你的点密度变得太高(例如,当你的屏幕上的点多于像素时),你不可能通过增加分数获得更多的收益。