YTickLabels at specified RGB values in colorbar

7 ビュー (過去 30 日間)
Subhiksha
Subhiksha 2013 年 10 月 16 日
編集済み: Adam Filion 2013 年 10 月 16 日
Hello all,
I have a jet colorbar appearing with my figure. I want to set the 'YTickLabels' at specified RGB values of the colorbar (i.e) at the points that bears the color with RGB value [0.3333 1 0.6667] in the colorbar i need to be named as 'A'.
Is there a way to do this???
Thanks in advance for the help.

回答 (2 件)

John Barber
John Barber 2013 年 10 月 16 日
Here is an example:
hSurf = surf(peaks);
hCbar = colorbar;
set(hCbar,'YTick',[-5 0.3 6],'YTickLabel',{'Blue','Green','Red'})
You will have to determine the y-values that correspond to the labels you want. For this, you should understand the different methods of colormapping ( direct vs. scaled ) and the axes CLim property. Here are links to some of the relevant documentation to help you get started:
  1 件のコメント
Adam Filion
Adam Filion 2013 年 10 月 16 日
Ah, I see I misunderstood the question above. I was thinking the reverse, of coloring the Y axis tick labels according to the color on the colorbar.

サインインしてコメントする。


Adam Filion
Adam Filion 2013 年 10 月 16 日
編集済み: Adam Filion 2013 年 10 月 16 日
Unfortunately I don't think there's any way to do this, supported or unsupported.
EDIT: Nevermind, I misunderstood the question, see John's answer, I think that should get what you're going for.

カテゴリ

Help Center および File ExchangeColormaps についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by