问题
Matlab's ribbon
function plots my matrix in the form of coloured ribbons, where ribbon number and point on the ribbon map to the row and column indices of the matrix, and the ribbon heights map to the element values. Each ribbon has its own colour.
I'm looking for a function that creates a plot like this, but where the colour indicates the height of the ribbon, i.e. the values in the matrix, similar to what surf
and waterfall
do. (Removing the black contour lines would also be neat.) How can I achieve this?

回答1:
ribboncoloredz.m just does that.
[x,y] = meshgrid(-3:.5:3,-3:.1:3);
z = peaks(x,y);
ribboncoloredZ(y,z);
xlabel('X');ylabel('Y');zlabel('Z');
回答2:
Turns out the same effect can be achieved using waterfall
:
h = waterfall(data);
set( h, 'LineWidth', 4 );
hidden off;

回答3:
Same problem, my solution was to make my own function from the built-in one:
Open "ribbon.m" in the editor : edit ribbon.m
Save it wherever you want under another name, like ribbonColAmpl.m
Line 46 delete the surface argument "n*cc," before 'parent'. This is what controls the fixed color of the concatenated surfaces.
Save the file and use this new function instead of the original one: Voila!
来源:https://stackoverflow.com/questions/8544823/how-to-make-colour-indicate-amplitude-in-matlabs-ribbon-plot