How can I change the transparency of a bar graph when I have two differnt data sets?
조회 수: 9 (최근 30일)
이전 댓글 표시
I am plotting 2 series of data with an arbitrary bin size (so the histogram plot looks really bad). For example:
close all
ages = [3 12 24 15 5 74 23 54 31 23 64 75];
binranges = [0 10 25 50 75];
binranges1 = [0 5 25 50 75];
[bincount,ind] = histc(ages,binranges);
[bincount1,ind1] = histc(ages,binranges1);
figure
bar(binranges,bincount);
hold on;
bar(binranges1,bincount1,'r');
I would like the image to look more like a histogram (shown next) but the histogram width looks really bad (so the smaller bin size affects the overall shape of the graph).
ages = [3 12 24 15 5 74 23 54 31 23 64 75];
binranges = [0 10 25 50 75];
binranges1 = [0 5 25 50 75];
histogram(ages,binranges);
hold on;
histogram(ages,binranges1);
I was thinking I would be able to change the facealpha property on the bar series plot but that is no longer the case. I was hoping to make the histogram have equal bin width graphically, even though the bins themselves are different sizes.
댓글 수: 1
Walter Roberson
2016년 2월 12일
Which MATLAB version are you using? R2014b had no way to set the bar alpha; R2015b does have a way to set the alpha; I would need to check the records to see if R2015a had it.
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Histograms에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!