![191127 114300-MATLAB Online R2019b.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250925/191127%20114300-MATLAB%20Online%20R2019b.png)
Why does my ticks/ticks label not match the colour in my colour bar?
4 views (last 30 days)
Show older comments
Hello,
I am trying to plot a colorbar for certain range of data, so far I have managed to make the color bar and it is showing the data as it should. However, I am struggling with the last step where one of the ranges for the colorbar is pretty close to another and they both fall into the same colour , orange in this case ( see pic).
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/249937/image.png)
I was wondering, how can I make that tick 7.1616 falls into the red colour?
cb = colorbar();
cb.Ticks = [0.7874 1.8296 3.1769 4.2870 5.4330 6.8412 7.1616 9.7830];
cb.TickLabels = {'0.78743[dS/m]'},{'1.8296[dS/m]','3.1769[dS/m]'},{'4.287[dS/m]','5.433[dS/m]'},{'6.8412[dS/m]'},{'7.1616[dS/m]'},{'9.783[dS/m]'}
colormap(cb,jet(length(8)));
caxis(plotHandler,[cb.TickLabels(1)*0 cb.TickLabels(end)]);
1 Comment
Adam Danz
on 27 Nov 2019
Look at your cb.Ticks (plotted below). The 7th value is not placed correcty. You just need to change that value.
![191127 114300-MATLAB Online R2019b.png](https://www.mathworks.com/matlabcentral/answers/uploaded_files/250925/191127%20114300-MATLAB%20Online%20R2019b.png)
Answers (1)
ME
on 25 Nov 2019
Not sure how to do it programatically but in the figure window you can go to "Edit -> Colormap..." and then move the little arrows to try and get the point you want inside the red section instead of the orange.
0 Comments
See Also
Categories
Find more on 2-D and 3-D Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!