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!
