How can draw univariate histogram in XY plane, YZ plane, and XZ plane in a 3-dimensional space?

조회 수: 4 (최근 30일)
I have N samples in four categories whose 3D coordinates are given. I want to plot univariate histograms for the X on XY plane at Z=0 of a 3D box. Next, on the adjacent walls of this box, I have to plot univariate histograms for Y on YZ plane at X=0 and univariate histogram for Z on XZ plane at Y=0.
I have attached data with categories.
I am new in matlab. Please help me.
  댓글 수: 2
Image Analyst
Image Analyst 2021년 12월 14일
Do you have a visualization of what you want the output to look like?
sharmin sathi
sharmin sathi 2021년 12월 15일
편집: sharmin sathi 2021년 12월 15일
I have attached an image that i want. This image is for one category data and present histogram Y axis and Z axis. But i want to represent histogram X axis, Y axis and Z axis for the four cateories data attached previously.
thanks in advance

댓글을 달려면 로그인하십시오.

답변 (1개)

Simran
Simran 2025년 3월 27일
To visualise your data in a 3D box specifically by plotting histograms on the walls of the box, you can follow the following steps:
1.) Import your data file into MATLAB using the “readtable” function.
2.) Extract the X, Y, Z coordinates from the table.
3.) Then create a new figure.
4.) Plot histogram for X on the XY plane at Z=0, Y on the YZ plane at X = 0, Z on the XZ plane at Y = 0 as follows:
subplot(2, 2, 1);
histogram(X);
title('Histogram of X (XY plane at Z=0)');
xlabel('X');
ylabel('Frequency');
view(2);
subplot(2, 2, 2);
histogram(Y);
title('Histogram of Y (YZ plane at X=0)');
xlabel('Y');
ylabel('Frequency');
view(2);
subplot(2, 2, 3);
histogram(Z);
title('Histogram of Z (XZ plane at Y=0)');
xlabel('Z');
ylabel('Frequency');
view(2);
After following the above steps and adjusting the layout, this is the figure I got:
For more help, you can refer to the following documentation:

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by