Problem with AlphaData property

11 Ansichten (letzte 30 Tage)
Leo
Leo am 27 Nov. 2021
Beantwortet: Star Strider am 27 Nov. 2021
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.

Antworten (1)

Star Strider
Star Strider am 27 Nov. 2021
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.)
.

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by