R2014b Histogram of multiple data sets
이전 댓글 표시
I'm trying to show histograms of four different vectors on a single set of axes and can't make it print them adjacent to one another, staggered, stacked, or anything other than right on top of each other.
code:
data1 = randn(20,1);
data2 = randn(30,1);
data3 = randn(40,1);
data4 = randn(50,1);
edges = -4:1:4;
histogram(data1,edges); hold on;
histogram(data2);
histogram(data3);
histogram(data4);
%Technically, I did these all with 'Normalization', 'probability' too to equalize height
Even with transparency it's impossible to tell what it shows. I tried grouping the four vectors into one array (with gap from different length vectors filled by NaN), but then the histogram function groups all the data together into a single chart. I'd like to show it so that for each bin (like 0-1), there are four bars in different colors side-by-side, ideally with a gap before the next block of four so it's clear which ones go together. Thanks.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Data Distribution Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!