prathmesh.kallurkar
prathmesh.kallurkar

Reputation: 5686

gnuplot data interpolation method for smoothing of data

Friends, i have some vast amount of data to be printed on a graph using gnuplot. Since the number of points in the graph is too large, i am using a cspline data interpolation method to smoothen the data. But the interpolation method is skipping some outliers which may be important in the analysis of performance of program. How should I make sure that the extreme outliers (values differing by more than x) are not missed by the gnuplot function.

Here is the code i am using to generate plots.

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   

The graphs generated are given below :

With CSplines

Without CSplines

I want gnuplot to smoothen points only if they are not too far (a configurable parameter) ?? Also can you suggest any other plotting tool that can do what i require ??

Upvotes: 0

Views: 3928

Answers (1)

mgilson
mgilson

Reputation: 309929

you could probably accomplish this with a combination of shell magic and set table. For example:

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

(Untested)

Upvotes: 2

Related Questions