How to create a colormap attributing specific colour to each element?
조회 수: 11 (최근 30일)
이전 댓글 표시
Hi everyone!
I have an array A,
A = [ 1 2 3 4
2 2 3 1
1 1 4 2];
I want to create a colormap but each element needs to be colored in a specific colour, for example, 1 is blue, 2 is black, 3 is green and 4 is yellow.
Thanks
채택된 답변
Matt Gaidica
2019년 1월 26일
Given these data, I would do this.
A = [ 1 2 3 4
2 2 3 1
1 1 4 2];
cmap = jet(max(A(:)));
figure;
imagesc(A);
colormap(cmap);
colorbar;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Orange에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!