Projection of 3D positions histograms in planes XY, YZ, and XZ

11 views (last 30 days)
I have N points whose 3D coordinates are given. I want to plot 2D histograms for the x- and y-coordinates on XY plane at Z=0 of a 3D box. Next, on the adjacent walls of this box, I have to plot 2D histograms for y- and z-coordinates on YZ plane at X=0 and 2D histogram for x- and z-coordinates on XZ plane at Y=0.
  2 Comments
Yatish Chandra
Yatish Chandra on 30 Jun 2020
Yes, 'hist3' takes in any Nx2 matrix to plot histograms bars in 3D. I am not sure how that helps?

Sign in to comment.

Accepted Answer

darova
darova on 30 Jun 2020
Here is an example
m = 20;
% generate some data
n = 500;
x = randn(500,1);
y = randn(500,1);
z = randn(500,1);
% create regular grid
x1 = linspace(min(x),max(x),m);
y1 = linspace(min(y),max(y),m);
[X,Y] = meshgrid(x1,y1);
% calculate density matrix
xy = hist3([x y],[m m]);
plot3(x,y,z,'.r')
surface(X,Y,xy*0-5,'cdata',xy)
axis vis3d
  4 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!