2 x 2d histograms from hist3
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi all,
I'm plotting a 3d histogram centered about x = 0 and y = 0. Is it possible to extract 2 x 2d histograms along the x and y axes from that 3d histogram?
Thanks and regards
Tim
3 Commenti
Adam Danz
il 9 Dic 2020
Could you find an image or drawing that looks like what you're trying to achieve?
Are you describing an axis with vertical and horizontal histograms, potentially overlapping, and if so, what happens with the 3rd dimension (the height of the 3D bars)?
Or are you describing a 3D histogram that is flattened to 2D where color depicts the height of the bars?
Risposte (1)
Steven Lord
il 9 Dic 2020
Let's say you had this 2-dimensional histogram.
xy = [1 1; 1 1; 1 1; 1 -1; 1 -1; -1 1; -1 1; -1 -1];
histogram2(xy(:, 1), xy(:, 2), 'XBinEdges', -1.5:1.5, 'YBinEdges', -1.5:1.5)
Would you want the 1-D histogram for y to look like this (note the horizontal lines, where the shorter bars in front end but the taller bars behind continue up?)
histogram2(xy(:, 1), xy(:, 2), 'XBinEdges', -1.5:1.5, 'YBinEdges', -1.5:1.5);
view([-1 0 0])
or this? Note that in this histogram, the order of the axes is the reverse of the order of the axes in the previous. You can set the YDir property of the axes to make the axes go from 1.5 down to -1.5 but the Answers code evaluation takes a "picture" of the figure prior to that command when I tried so I removed the command.
histogram(xy(:, 2), 'BinEdges', -1.5:1.5);
0 Commenti
Vedere anche
Categorie
Scopri di più su Data Distribution Plots in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!