Problem with AlphaData property
显示 更早的评论
I have a figure of several plots. I want each plot to have its own gradient fill (meaning maximum: full color, minimum: fully transparent; separately for each plot). I wrote a simple example, unfortunately the result is not according to my ideas. The maximum for the second plot does not have a solid red color, but is already partially transparent. Why? And how would that be right?
figure
Color1 = 'r';
hold on
% Plot 1
x = 0:0.2:10;
y = sin(x)+10;
xx = [x;x];
yy = [y;y*0];
plot1 = surf(xx,yy,xx*0,'alphadata',yy,'facealpha','interp','edgecolor','none',"FaceColor",Color1);
% Plot 2
x2 = 0:0.2:10;
y2 = sin(x2)+5;
xx2 = [x2;x2];
yy2 = [y2;y2*0];
plot2 = surf(xx2,yy2,xx2*0,'alphadata',yy2,'facealpha','interp','edgecolor','none',"FaceColor",Color1);
view(2)
Figure below is as I would like it.

回答(1 个)
Star Strider
2021-11-27
0 个投票
The FaceAlpha (transparency) value is set to 'interp' and it is doing exactly what it is told to do!
It will likely be necessary to experiment to get the desired result. (I have no idea what the desired result is, so I have no idea what would need to be changed.)
.
类别
在 帮助中心 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
