How can I change number on colorbar caxis?
조회 수: 27 (최근 30일)
이전 댓글 표시
My colorbar is equidistant,
I want to change the colorbar range,be a not equidistant colorbar.
Below is my colorbar.(caxis[(1500,5500)])
I want to change to like below's figure(From Internet).
How can I change the value?
Thank you.
댓글 수: 0
답변 (1개)
Walter Roberson
2018년 1월 17일
편집: Walter Roberson
2019년 7월 22일
Record the handle of the colorbar when you create it. Set the Ticks property of the handle to the list of values you want (or possibly YTicks property, depending how old your MATLAB is.)
The way to create a colorbar (or colormap) that is not uniform in step width is to calculate the greatest common divisor (GCD) of the step sizes, and then to repeat colors as many times as (step width divided by GCD). In your example your smallest width is (50-0) = 50, so you would create a table in which the first entry (0 to 50) was the first color, and the next (200-50)/50 = 3 entries were the same second color, and the next (500-200)/50 = 6 entries are the same third color, the 6 entries after that the same fourth color, the (1000-800)/50 = 4 entries after that the same fifth color, the 10 after that the same sixth color, and so on.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Colormaps에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!