Colorbar with three colors

조회 수: 9 (최근 30일)
Yunhui He
Yunhui He 2017년 10월 3일
답변: KSSV 2017년 10월 3일
I am using surf plot the pictures. I want to see the colorbar at the right-hand side. But the transition of the color is not so obvious. I want to see from green to red, and there is another color in the middle. How can I do this?
Thanks!
  댓글 수: 1
Walter Roberson
Walter Roberson 2017년 10월 3일
Are there only 3 colors in the plot, or is it that you only want three colors to appear in the colorbar ?
If you are already doing colormap() in order to activate a colormap of three colors, then colorbar() should adjust automatically.

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

채택된 답변

KSSV
KSSV 2017년 10월 3일
Z = peaks(100) ;
surf(Z)
shading interp
cmap = [1 0 0 ; 0 1 0 ; 0 0 1] ;
colorbar
colormap(cmap)

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Color and Styling에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by