How to modify the showing colorbar range?
3 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
zongxian
am 27 Aug. 2020
Kommentiert: zongxian
am 27 Aug. 2020
External program will be created a image, for example
image(rand(100,100)*10)
colormap(rand(10,3))
I will add a colorbar by my function, it simple
colorbar
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352238/image.png)
Now I only show part of the colorbar by colorbar('Ylim',[1,6]). But I want to change the color of the 5th color block, let it same as the last color block. (the 5th color block of the right image should be changed to the last color (of left image)).
No need to care about the Ticks of the 5th color block, (maybe showing like '>5', or any other string).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/352241/image.png)
0 Kommentare
Akzeptierte Antwort
Image Analyst
am 27 Aug. 2020
Try this:
image(rand(100,100)*10)
cmap = rand(10, 3)
colormap(cmap)
% Now put color in block 10 into block 5
cmap(5) = cmap(10);
colormap(cmap);
caxis([1, 6])
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Colormaps finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!