How can draw univariate histogram in XY plane, YZ plane, and XZ plane in a 3-dimensional space?
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (1)
Simran
am 27 Mär. 2025
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:
“histogram”: https://www.mathworks.com/help/releases/R2021a/matlab/ref/matlab.graphics.chart.primitive.histogram.html
0 Kommentare
Siehe auch
Kategorien
Mehr zu Histograms finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!