#286 Smooth Step

open
nobody
None
5
2013-02-10
2011-03-16
Douglas
No

The function smoothing procedures are extremely useful for comparing sets of data which may not have the same x-values. For instance, by smoothing two different datasets on the same sample settings, one can save the results to two tables, paste the tables together and plot the difference. Tremendously useful!

However, sometimes the data you want to compare should be step-wise. This is why we have "with steps" and "with fsteps" as plotting options. However, it is currently impossible to compare two sets of data if one is step-wise and the other isn't. For instance, it is impossible to execute filledcurves between two plots like that, or to subtract the difference and plot the result.

I propose "smooth step", an utterly simple smoothing function which accomplishes the goal by sampling the data according to a step function, as opposed to splines, gaussians, etc.. Moreover, it make it significantly easier to address my concerns in "Filled Steps".

Discussion

  • Ethan Merritt
    Ethan Merritt
    2011-03-16

    I do not understand what "sampling the data according to a step function" means.
    Do you just mean linear interpolation at fixed intervals? That would be strictly worse than the existing options.

     
  • Douglas
    Douglas
    2011-03-16

    "Strictly worse" is a matter of opinion. For instance, linear interpolation between data points is essentially what some options of dgrid3d do. My goal isn't to make smooth-looking interpolations, but to allow myself to compare two sets of data, whose data points are fairly sparse in x and don't line up.

    What I mean by smoothing according to a step function is simpler than what you propose: sample at regular intervals and return the value of the next-lowest-x-value point. For fsteps, it's the next-highest-x-value-point.

     
  • Douglas
    Douglas
    2011-03-17

    I notice there hasn't been a response. Is there anything I'm leaving unclear? If there is, I certainly will do my best to help!

     
  • Ethan Merritt
    Ethan Merritt
    2011-03-17

    You haven't convinced me that this is a reasonable thing to do.
    If you have two data sets intrinsically tied to uneven sampling intervals, I'm not sure it makes sense to compare them at other point _at all_. In other words, I am unconvinced that the plot you want to create makes sense.

    But I'm only one person, the one who happens to be keeping an eye on this tracker. Maybe you should post this suggestions to the developer mailing list to see if more discussion is forthcoming. Not all of the developers are checking this Feature Request tracker regularly.

     
  • Douglas
    Douglas
    2011-03-17

    Oh! Okay, I attached an image of what I'm talking about. In another plot, I wanted to show the difference between the step function and the original data, and show quantitatively how the approximation improves at higher x-values. The problem is that the step function is simply the data points at each step, so I can't subtract the original data from the approximation.

     
  • Ethan Merritt
    Ethan Merritt
    2011-03-17

    Sorry, I still don't understand quite what you're looking for. The plot you attached looks reasonable. What's wrong with it?

     
  • Douglas
    Douglas
    2011-03-17

    I will want to subtract the difference between the step function and the original data to be able to compare the fluctuation (difference between the two functions) over time. Exactly how much those dips in the original data go down from the step function matters, and I want to be able to display it.

     
  • Ethan Merritt
    Ethan Merritt
    2011-03-17

    Is this a correct generalization of the problem?
    Some analytic function F(x)
    Some data set D(x), sampled at unkown intervals
    You want to plot D(x)-F(x)

    In gnuplot, this would be
    plot 'D' using 1:($2-F($2))

    Do I have that right?
    In other words, if you know what F(x) is to create a data file, why can't you just put it in the gnuplot script?

     
  • Douglas
    Douglas
    2011-03-17

    In this case, it wasn't a simple function. I could go into details: essentially, there was a third signal, and then the data between spikes in the third signal were averaged with a certain weight, etc. It was actually programmed in Matlab.So all I have is the sparse data points and the original data.

     
  • Douglas
    Douglas
    2011-03-18

    I suppose I'm not generating too much enthusiasm so I'm posting this on the developer's mailing list. If there's anything else you might suggest, I'm all ears, though!