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

6 vues (au cours des 30 derniers jours)
Javier
Javier le 25 Nov 2019
Commenté : Adam Danz le 27 Nov 2019
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 commentaire
Adam Danz
Adam Danz le 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

Connectez-vous pour commenter.

Réponses (1)

ME
ME le 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.

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by