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

4 ビュー (過去 30 日間)
sharmin sathi
sharmin sathi 2021 年 12 月 13 日
回答済み: Simran 2025 年 3 月 27 日
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 Center および File ExchangeHistograms についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by