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

조회 수: 2 (최근 30일)
Javier
Javier 2019년 11월 25일
댓글: Adam Danz 2019년 11월 27일
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