How to specify the RGB color of each line in a waterfall plot?
11 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Adam
2017-2-21
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!