How to set number of value ranges in colorbar?

조회 수: 58 (최근 30일)
Simson Hutagalung
Simson Hutagalung 2022년 8월 6일
답변: Cris LaPierre 2022년 8월 6일
Hello everyone, i wanna ask, how to set number of value ranges is equal with number of color grading in colorbar?
Color grading have 14 colors, but the value just 10. Thank you
  댓글 수: 1
Walter Roberson
Walter Roberson 2022년 8월 6일
I do not seem to be able to replicate that when I activate a colormap that I have set a specific size for.
cmap = flag(10);
colormap(cmap);
colorbar()

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

답변 (1개)

Cris LaPierre
Cris LaPierre 2022년 8월 6일
% Create data & plot
data = peaks(25);
contourf(data)
cmap = jet(14);
colormap(cmap);
% Specify tick locations in colorbar automatically
cl = clim;
ct = linspace(cl(1),cl(2),size(cmap,1)+1);
c=colorbar('Ticks',ct);

카테고리

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

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by