Why does my ticks/ticks label not match the colour in my colour bar?

2 次查看(过去 30 天)
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).
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 个评论
Adam Danz
Adam Danz 2019-11-27
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

请先登录,再进行评论。

回答(1 个)

ME
ME 2019-11-25
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.

类别

Help CenterFile Exchange 中查找有关 Annotations 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by