Change amount of ticks on a colorbar
59 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Marc Jakobi
am 4 Sep. 2013
Bearbeitet: Marc Jakobi
am 17 Nov. 2016
Hi.
I have a 2D contour
contour(handles.Object,x,y,z,...)
where I set the colour map using an rgb matrix
b = (.23 .6 .8;...
.7 .8 .9;...
etc)
caxis([20 50]);
cbr = colormap(b)
colorbar
By default, the colorbar has seven ticks. What I want to do is create a colorbar in the range between 20 and 50 with a tick right at the bottom marking "20", one right at the top marking "50" and ticks marking 22, 24, 26, 28,... (steps of 2) inbetween.
If I type
set(cbr,'YTickLabel',{'20','22','24','26',[...],'50'})
the colormap only returns the first seven values in the positions of the initial five ticks.
Is there a way to manipulate the AMOUNT and POSITIONS of the ticks so that I can get a colorbar as described above?
Thanks!
Marc
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
Diana
am 17 Nov. 2016
Is there any way to set the number of ticks? I mean whatever the values are, I want always 5 ticks in the colorbar.
1 Kommentar
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!