Apply a color map to a 2d line
98 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Nigel Davis
el 17 de Mayo de 2022
Comentada: Nigel Davis
el 17 de Mayo de 2022
Hi
My code outputs a line graph from an array as seen below.
I need to apply a simple colourmap, say from blue to green for example, to this line from another set of values.
I think I can create the required colourmap but I don't know how to apply it to the line!
Any assistance would be greatly appriciated.
Thanks.
line(lans(1,:),1:61,'LineWidth',10)
0 comentarios
Respuesta aceptada
KSSV
el 17 de Mayo de 2022
Read about patch
x = linspace(1,10,15);
y = sin(x);
y(end) = NaN;
c = y;
figure
patch(x,y,c,'EdgeColor','interp');
colorbar;
Más respuestas (0)
Ver también
Categorías
Más información sobre Colormaps en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!