필터 지우기
필터 지우기

Plot two histograms over one another

조회 수: 191 (최근 30일)
dj1du
dj1du 2022년 8월 2일
댓글: dj1du 2022년 8월 3일
Good evening,
I created a plot with histograms and corresponding pdfs. How can I plot the two histograms in each diagram such that the bars of the blue histogram aren't hidden behind the red ones? I found some related answers, in which the parameter facecolor was changed in order to introduce some opacity, but the result did not look satisfy to me regarding the ability to visually distinguish between the two histograms.
Thank you very much for your help!

답변 (1개)

David Hill
David Hill 2022년 8월 2일
편집: David Hill 2022년 8월 2일
Play with the color and alpha face to get something you like.
h1 = 0.05 * randn(1, 10000);
h2 = 0.20 * randn(1, 10000);
histogram(h1,'facealpha',.7,'edgecolor','none');
hold on;
histogram(h2,'facealpha',.3,'edgecolor','none');
  댓글 수: 1
dj1du
dj1du 2022년 8월 3일
Thank you for your answer! Your plot looks very good, but, unfortunately, when I apply the exact same code to my data the result looks rather confusing. I attached the raw data of the two histograms, perhaps someone can find a better solution.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Histograms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by