plot the lines with different color
Mostrar comentarios más antiguos
Dear all,
I have generated a plot using x and y and would like to add color on it based on its value (diameter of line). I have used the https://github.com/vistalab/vistateach/blob/master/cogneuro/tutorial1_timeseries/vals2colormap.m
to convert my range of value to rgb value
x = [0.168149323 0.547990492 0.580721962 0.502272216 0.321295719 0.168149323];
y = [0.565541486 0.530969047 0.570321397 0.878624621 1.069086578 0.565541486];
colorrange=[27.65 22.11 23.11 25.11 26.74 26.94]
rgb=vals2colormap(colorrange, 'jet',[22.11 27.65])
%rgb=[0.5,0,0;0,0,0.515625;0,0.234375,1;0.671875,1,0.3281250;1,0.15625,0;1,0.015625,0]
%rgb is colormap value for different line
for k = 1 : length(rgb)
hold on
% Get new values.
plot(x, y,'-', 'Color', rgb(k,:) ,'LineWidth',2)
end
however, when I plot them out, all the color are the same.

any idea I can make different line to different color based on their specific value?
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre Blue en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
