2D line plot with colormap
36 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 !
0 comentarios
Respuestas (1)
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.
If you want colored lines then see for example http://www.mathworks.com/matlabcentral/answers/285872-shading-with-plot3#answer_223465
0 comentarios
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!