How can I set the colorbar for a specific series of value ?

조회 수: 1 (최근 30일)
wenhao yang
wenhao yang 2021년 8월 25일
댓글: wenhao yang 2021년 8월 25일
Just like the color bar in this figure. When I save this figure, the color bar shows (500 1000 1500 2000).
I want the color bar to show like this [300:600:900:1200:1500:1800:2100].

채택된 답변

Simon Chan
Simon Chan 2021년 8월 25일
Adjust the Limits and Ticks as follows:
cb = colorbar
cb.Limits = [300 2100];
cb.Ticks=300:300:2100;
  댓글 수: 4
Simon Chan
Simon Chan 2021년 8월 25일
Then, you need to change the TickLabels as follows:
oldLabel = cb.TickLabels;
cb.TickLabels = cellfun(@(x) sprintf('%.1f',str2double(x)),oldLabel,'UniformOutput',false);
wenhao yang
wenhao yang 2021년 8월 25일
thank you so much~

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

추가 답변 (0개)

카테고리

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