2 x 2d histograms from hist3

1 vue (au cours des 30 derniers jours)
Tim Fulcher
Tim Fulcher le 9 Déc 2020
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 commentaires
Tim Fulcher
Tim Fulcher le 9 Déc 2020
Two 2d histos. In this case one on the x axis and the other on the y axis.
Adam Danz
Adam Danz le 9 Déc 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?

Connectez-vous pour commenter.

Réponses (1)

Steven Lord
Steven Lord le 9 Déc 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);

Catégories

En savoir plus sur Data Distribution Plots dans Help Center et File Exchange

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by