How to make colour indicate amplitude in Matlab's ribbon plot?

谁说我不能喝 提交于 2019-12-12 12:33:14

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!