I have a series of 3D data points (x,y,z) , How can plot the histogram of these points and see the frequency of these location (the distribution of frequency of data)?

16 views (last 30 days)
I have a series of 3D data points (x,y,z) , How can plot the histogram of these points and see the frequency of these location (the distribution of frequency of data)?

Answers (1)

Image Analyst
Image Analyst on 24 May 2014
You can do scatter3 and let the marker size be an indication of the number of counts.
Or, since it's analogous to a color image (which is a 3D array also), you can use the color frequency image. It assigns an intensity to each data point based on how frequently that data point (color or x,y,z value) shows up in the image. See http://www.mathworks.com/matlabcentral/fileexchange/28164-color-frequency-image for an example and code.
  2 Comments
Daniel Bridges
Daniel Bridges on 2 Apr 2016
A set of 3D points is not equivalent to a color image unless one sums the third axis, effectively losing data; otherwise points will "lie on top of each other" when viewing a given plane: (1,2,5) and (1,2,-5) are coincident when looking at the plane containing the "pixel" (1,2).
I do not see that this answer helps beyond supplying a method of visualization: Looking at the scatter3 documentation, it seems you can only adjust the marker size after creating the histogram Tavakkoli has mentioned.
Image Analyst
Image Analyst on 2 Apr 2016
The first paragraph is not at all what I was talking about.
You're right in the second paragraph that once you have the 3-D histogram, which is trivial to construct with a triple nested for loop, that that histogram then gets passed in to scatter3() along with size and color arrays that indicate the height (count) of the histogram bin. It is a method of visualization as you say, and is what he asked for. I'm not sure what "beyond" would mean to you. Was I supposed to give the triple nested for loop for computing the histogram? He didn't ask for that - he asked only for a way to plot (visualize) the histogram, not create it.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!