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
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.)
.

카테고리

제품

릴리스

R2021b

태그

질문:

Leo
2021년 11월 27일

답변:

2021년 11월 27일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by