2 x 2d histograms from hist3
조회 수: 4 (최근 30일)
이전 댓글 표시
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
Adam Danz
2020년 12월 9일
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?
답변 (1개)
Steven Lord
2020년 12월 9일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!