필터 지우기
필터 지우기

change colors of an array

조회 수: 2 (최근 30일)
m_vdv
m_vdv 2018년 5월 23일
답변: Ameer Hamza 2018년 5월 23일
I've got the following array. M = [0 1 0; 1 0 1; 2 0 3];
imagesc(M)
How can I change the colors of the image?
  댓글 수: 1
Paolo
Paolo 2018년 5월 23일
Have you tried changing the values contained in M ?

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

답변 (1개)

Ameer Hamza
Ameer Hamza 2018년 5월 23일
the color of the square depends on the colormap of the axis. Try
ax = gca;
ax.Colormap
by default colormap is
0.2422 0.1504 0.6603
0.2504 0.1650 0.7076
0.2578 0.1818 0.7511
....
....
0.9691 0.9606 0.1064
0.9769 0.9839 0.0805
These are RGB colors. The value in your matrix M, along with the colormap and clim property of axes object which color will be displayed. For more information, refer to the properties of MATLAB axes object and search for Colormap and CLim.

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by