2D line plot with colormap

36 次查看(过去 30 天)
Marco Fellous Asiani
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 !

回答(1 个)

Walter Roberson
Walter Roberson 2016-5-31
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.

类别

Help CenterFile Exchange 中查找有关 Colormaps 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by