In this node I complained about Excel's ancient limitations that make charting large data sets with it impossible.

Various solutions were proposed, but I was looking for something quick and as non-drastic as possible. Moving away from Excel is not an option, at the moment, for various reasons.

So, I decided to resample the data. Having N data points when N > MAX_LIMIT (about 32k for Excel charts) I have to resample the data in such a way as to display it in less than MAX_LIMIT points.

Now, naive sampling doesn't work here because this way it's easy to lose interesting information (assume I have all the data 0 and a single 1 somewhere. I want to see it, and using a trivial resampling algorithm the chance for seeing it is small).

The solution I've currently set on is a "maximum filter". I divide the data to "windows" and take one "representable" value from the window - the maximal data value.

This works very nicely since we don't have negative data, but I wonder what are the more general algorithms for arbitrary data ?

After all, Excel and other plotters use it. Even if I plot only 32000 points, there still are only ~1000 pixels in my screen so Excel does some resampling of its own.


In reply to intelligent re-sampling of data by spurperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.