Zdata(N,1) to RGB Cdata(N,1,1:3)

1 visualización (últimos 30 días)
Arthur Allen
Arthur Allen el 19 de Mzo. de 2013
I have lat, long, and skill vectors. All vectors are (n,1). (skill ranges from 0.0 to 1.0)
for j = 1:n_validlength;
plotm(Lat_NCOMwCodar(j),Lon_NCOMwCodar(j),0,'Marker','s','MarkerSize',12,...
'MarkerFaceColor',skill_color_NCOMatCodar(j,jj,:));
end
where skill_color_NCOMatCodar(j,jj,1:3) is colormap('jet') from skill_NCOMatCodar(j,jj)
How to set the relationship between SKILL(n,jj) range 0.0 to 1.0 to SKILL_COLOR(n,jj,1:3) ?
I can not use contourm, geoshowm, because data is not at i,j mesh, image. Ilregular grids are used.

Respuesta aceptada

Arthur Allen
Arthur Allen el 19 de Mzo. de 2013
Solved my own question:
cmap_jet = colormap(jet(64)); % used colormap 'jet' with 64 colors
for j = 1:n
if skill(j) == 0;
skill_color(j,:) = ([0 0 0]); % set to black
else
% return index from 1 to 64 based upon skill level (data) from 0.0 to 1.0
% note: skill.*number_of_colors_in_colormap
% note: goal: return indexes from 1 to 64 starting with data range.
skill_color_idx(j) = uint8(ceil(skill(j).*64));
% now return cmap_jet row :RGB as color of skill
skill_color(j,:) = cmap_jet(skill_color_idx(j),:); % jet colors
end
end

Más respuestas (0)

Categorías

Más información sobre Colormaps en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by