4

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?

matlab ribbons

0

3 Answers 3

2

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'); 

example

Sign up to request clarification or add additional context in comments.

1 Comment

The submission boils down to setting some properties after calling h = ribbon(y,z), i.e. set(h, {'CData'}, get(h,'ZData'), 'FaceColor','interp','MeshStyle','column')
0

Turns out the same effect can be achieved using waterfall:

h = waterfall(data); set( h, 'LineWidth', 4 ); hidden off; 

enter image description here

Comments

0

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!

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.