3

this question is an extension of my previous question that you can find here:

How to plot a data cube in python

The thing is that I have a 3D plot of point but if I follow the method of my previous question I could get an overflow error when I have too many points to plot. I have to plot millions of points so I need to smooth the 3D distribution, otherwise it takes a huge amount of time to make the plot and I could also get memory errors.

I was thinking that maybe I can convolve the distribution with a Gaussian kernel, but I don't know if it's the best option. Moreover, I am not able to do it yet.

Community
  • 1
  • 1
Brian
  • 13,996
  • 19
  • 70
  • 94
  • I think the answer depends upon which information you consider the most important. There are different options, depending on which information you are more willing to lose. – user e to the power of 2pi Aug 17 '11 at 11:49
  • I am interested on the spatial distribution of this point, on average. – Brian Aug 17 '11 at 12:06
  • First: if you have millions of points, will you ever be able to see past the edges of your cube? In other words: is a 3d visualization the best idea or might you be better off making 2d slices (for example?. Furhermore: you might construct a 3d array, filling every cell with the mean or median of the points within that cell. – Daan Aug 17 '11 at 12:42
  • Yes, you're right, that's what I did for a 2D visualization, but I would like to see the data cube. – Brian Aug 17 '11 at 13:01
  • Could you give an example of how your preferred solution should look? Perhaps a pen&paper sketch of your ideal graph. Or is your question merely how you can reduce the number of points while losing minimal information? Then a sample of your data would help: are the points clustered or evenly spread? Are the function values at (x,y,z) randomly varying or smoothly distributed? Etcetera, etcetera. – Daan Aug 17 '11 at 14:39
  • No, my point are not evenly spread. I would like to have something like this http://blogs.discovermagazine.com/badastronomy/files/2007/darkmatter_blobs.jpg – Brian Aug 19 '11 at 07:15

1 Answers1

0

As I answered in original question, the Dots plot is good for you. It is produced by MathGL -- GPL plotting library. Add it don't need many memory if you save in bitmap format (PNG, JPEG, GIF and so on).

However, there are another option for smoothing itself: (i) make histogram of point distribution (i.e. average points values or colors inside some cell) -- in frame MathGL you can use Hist() function even for points in 3D space; or (ii) using standard smoothing functions (like mglData::Smooth() in MathGL), but here you need to use regular arrays, i.e. as {x[i,j,k], y[i,j,k], z[i,j,k], c[i,j,k]}.

Both variant will give you regular arrays which can be plotted by a set of different ways -- see these samples.

abalakin
  • 825
  • 7
  • 6