2D line plot with colormap

36 visualizaciones (últimos 30 días)
Marco Fellous Asiani
Marco Fellous Asiani el 31 de Mayo de 2016
Respondida: Walter Roberson el 31 de Mayo de 2016
I would like to print a 2D curve (so a line in the plane X,Y) with its colourmap.
I have done this :
figure('Name', name);
plot3(X,Y,squeeze(Z));
view(2)
But I would like to add a colourmap just like I do with surf :
figure('Name', name);
surf(X,Y,squeeze(Z));
colorbar;
shading interp;
view(2);
How to do that ?
Thanks !

Respuestas (1)

Walter Roberson
Walter Roberson el 31 de Mayo de 2016
plot() and plot3() do not use colormaps . They use ColorOrder property of the axes. Each line object that is drawn by plot() or plot3() is a single color that by default is chosen from a pre-determined list according to the order it is drawn, not according to the Z coordinate. It is not possible to use plot() or plot3() to have the line colored by Z coordinate.

Categorías

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

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by