How to specify the RGB color of each line in a waterfall plot?
10 views (last 30 days)
Show older comments
Is there a way to specify the RGB color of each line in a waterfall plot? It seems like I can't set the 15 individual lines' edge color to the corresponding rgbDesired values in the w1 patch example below. I could plot each 'line' as a separate vertical patch and set its edge color individually, but is there a better way?
figure;
[X,Y,Z] = peaks(50);
% Make different x,y dimensions to make it easier to understand
ix = 1:15; % Will produce 15 lines
iy = 1:20;
X = X(ix, iy); Y = Y(ix, iy); Z = Z(ix, iy);
w1 = waterfall(X,Y,Z); % Waterfall with color set by peak height
% Alternative RGB values we seek to use for each line
rgbDesired = rand(length(ix), 3);
w1 =
Patch with properties:
FaceColor: [1 1 1]
FaceAlpha: 1
EdgeColor: 'flat'
LineStyle: '-'
Faces: [15×25 double]
Vertices: [375×3 double]
0 Comments
Accepted Answer
Adam
on 21 Feb 2017
I'm not really familiar with waterfall plots, but when I run your code there are 15 lines and the CData is also 15x25 so I'm not sure where 20 colours would fit exactly.
You can edit the whole CData at once, e.g.
w1.CData = rand( 25, 15, 3 );
but it has to be the expected size.
More Answers (0)
See Also
Categories
Find more on Polygons in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!