0

I have a big array, have 640000 elements type double. I need to plot values, but the array's length is enormous and it consumes processor resources.

The resolution of my screen is only 600x600.

How can I to shrink my big array for plot it with only 400 possible values(200 dots for borders).

I was trying to use Java, but I have no idea for beging... Hi

I'm plotting X,t (time)..

    double BigArray = new double[640000];
    //...
    filling the vector
    //...
    calculating resolution available (dots)
    int n = 400;
    //...
    double LitArray = new double[n];
    double TimeArray = new double[n];
    //...
    calculating new values for LitArray and TimeArray.
    //...

Thanks

joseluisbz
  • 1,491
  • 1
  • 36
  • 58
  • If you want to shrink your array from 640k to 400, you will lose a lot information and your plot wont be representative, at less than you design an intelligent algorithm according to your needs, that select most representative values. – Pablo Claus Jul 26 '12 at 02:12
  • See also this [answer](http://stackoverflow.com/a/8533194/230513). – trashgod Jul 26 '12 at 05:12

1 Answers1

0

You haven't stated what kind of plot you require... Bar? Line? Scatter?

I'll assume it's a line plot and that you have 640000 y-values for a linearly increasing x-series.

What you would normally do is partition the array into 400 buckets. So make an array with 400-elements in it. You'll have 1600 values per bucket, so you just need to decide what to do with them.

The normal thing would be to average the 1600 elements in each bucket, making a single value for each pixel position. But if you need to be really fast you can just take a representative sample (say, 16 elements evenly spaced) or even just a single value from each bucket.

You might actually want the minimum and maximum value of each bucket, and you would draw a line from one to the other at each pixel position. That way your zoomed-out graph would still cover the range of each bucket and not end up conveying the wrong information...

paddy
  • 60,864
  • 6
  • 61
  • 103
  • Thank you for asking... Only I want to calculate the new values... I need the algorithm.. – joseluisbz Jul 26 '12 at 03:03
  • Yes, but WHICH new values? Do you want the averaged values, the min and max, a representative sample, a single value sample...? – paddy Jul 26 '12 at 04:40