how to get the RGB number from colorbar

조회 수: 19 (최근 30일)
Yu Li
Yu Li 2019년 4월 18일
편집: Yu Li 2019년 4월 18일
Hi:
I have a colorbar like below:
2.jpg
or to simplify this question, I assume the color is from blue (RGB [0,0,1]) to red (RGB [1,0,0]).
is there anyway to get the detail RGB nubmer for each color in this colorbar? in other words, I want to split the colorbar into 1000 parts, is there anyway to got the RGB number of each part?
Thanks!
Yu

답변 (1개)

Adam
Adam 2019년 4월 18일
편집: Adam 2019년 4월 18일
colourmap = colormap( hAxes );
where hAxes is the axes handle. gca if you really must!
You can then interpolate it to make it bigger or smaller if you wish.
If it is a builtin colourmap though, for example 'Jet', you can just use
colourmap = jet( 1000 );
to get a 1000-element Jet colourmap (not that I am advising using Jet, it was just the one that came to mind and is most similar to the one you show).
  댓글 수: 1
Yu Li
Yu Li 2019년 4월 18일
편집: Yu Li 2019년 4월 18일
Thanks for you reply.
you mentioned 'then interpolate it to make it bigger or smaller', could you please let me know how I can do that?
for example, the colormap is from blue ([0,0,255]) to red ([255,0,0]), is there anyway to interpolate 1000 colors between them?
Bests,
Yu

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Colormaps에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by