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

8 visualizaciones (últimos 30 días)
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 comentarios
darova
darova el 30 de Jun. de 2020
Use hist3 to calculate a matrix of values
Yatish Chandra
Yatish Chandra el 30 de Jun. de 2020
Yes, 'hist3' takes in any Nx2 matrix to plot histograms bars in 3D. I am not sure how that helps?

Iniciar sesión para comentar.

Respuesta aceptada

darova
darova el 30 de Jun. de 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 comentarios

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by