Projection of 3D positions histograms in planes XY, YZ, and XZ
11 views (last 30 days)
Show older comments
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
Accepted Answer
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
More Answers (0)
See Also
Categories
Find more on Annotations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!