- create multiple (possibly overlapping) axes and use a different colormap for each; or
- convert all-but-one of the graphic objects to use RGB instead of mapped colors; or
- convert all of the graphics objects to use RGB; or
- convert the graphics objects to be different kinds of graphics objects that can use RGB
Apply different colormaps to different data sets on histogram2
조회 수: 3 (최근 30일)
이전 댓글 표시
histogram2(x, y, xedges, yedges, 'normalization', 'probability', 'DisplayStyle','tile', 'FaceColor','flat')
hold on
histogram2(x2, y2, xedges, yedges, 'normalization', 'probability', 'DisplayStyle','tile', 'FaceColor','flat')
hold off
colormap summer
colorbar

Here, I have two different datasets with the histogram2 function, but I'm not sure how to apply different colormaps to each of them.
댓글 수: 0
답변 (1개)
Walter Roberson
2023년 4월 21일
편집: Walter Roberson
2023년 4월 21일
MATLAB permits one colormap per axes .
If you need more than one colormap then you have a couple of choices:
There is a useful File Exchange contribution freezecolors that can convert objects to RGB -- though it might not have caught up to some of the newer graphics objects.
Looking at Histogram2 objects, it does not look to me as if they can be converted directly to RGB. But you appear to be viewing from above -- which is a situation where you can create arrays of values and use imagesc() or pcolor() as long as you do not need to permit the user to dynamically change the histogram properties.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Color and Styling에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!