Making a Surface plot transparent
Mostrar comentarios más antiguos
I am trying to make my surfaces transparent so I can see both when they are on top of each other/behind the other.
I have one surface for my aci/acj graph called CritCon and one for my inequalities ineq1/ineq2 called Condition
I have tried 'FaceAlpha', 0.3 in the surf( ) command as well as Alpha(0.3) after the surf() command, neither seems to work.
Thank you!
%define the set parameters
meshsize=.01; %changing this to be lower gives weird graphs
%gamma
g = 0.2;
%-------Param 0 ----------------
bj=2.34;
muj=0.4;
%define the range of x (deltai),y (betai) coordinates
mui=muj:.1*meshsize:7.6+muj;
bi=bj:.36587*meshsize:30;
%-------Param 0 ----------------
% Mesh Grid
[X,Y] = meshgrid(mui,bi);
%------------------------Inequalities---------------------------------------------------------
%Inequality 1 is for Sij>0 and Ri>1.
%Inequality 2 is for Sji>0 and Rj>1.
ineq1= Y > (2*bj.*(X+g).*(g+muj).*(X+g+muj))./(bj.*g.*(X-muj)+(g+muj).*(X+2*g+muj).*(g+2*muj));
ineq2= Y < (bj.*(X+g).*(2*X+g).*(X+2*g+muj))./(bj.*g.*(X-muj)+2.*(X+g).*(g+muj).*(X+g+muj));
aci = (1+(-2).*X.*(g+2.*X).^(-1).*Y.*((-1).*g+(-1).*X+Y).^(-1))<=(0);
acj = (1+(-2).*bj.*(bj+(-1).*g+(-1).*muj).^(-1).*muj.*(g+2.*muj).^(-1))<=(0);
%------------------------Inequalities---------------------------------------------------------
Condition = ineq1.*ineq2;
Condition(Condition==0) = NaN;
CritCon = aci.*acj;
CritCon(CritCon==0)=NaN;
%---------------------------Surfaces-------------------------------------
surf(X,Y,CritCon,'EdgeColor', '[0.3010, 0.7450, 0.9330]','FaceAlpha',0.3)
hold on
surf(X,Y,Condition,'EdgeColor', '[0.6350, 0.0780, 0.1840]','FaceAlpha',0.3)
%---------------------------Surfaces-------------------------------------
%----------------------------Labels--------------------------------------
xlabel('\mu_i')
ylabel('b_i')
view(0,90)
title('R_i,R_j>1 , S>0 (and crit cond) when \mu_j=0.4, b_j=2.34.')
%----------------------------Labels--------------------------------------
hold off
1 comentario
Walter Roberson
el 1 de Mzo. de 2022
Edgecolor would normally be numeric not character vector.
Respuesta aceptada
Más respuestas (1)
Johan
el 1 de Mzo. de 2022
0 votos
I think FaceAlpha does work but your mesh size is so small that you only see the edges plotted which are not transparent in your case. You can use EdgeAlpha to see if the graph looks better that way.
2 comentarios
Ursula Trigos-Raczkowski
el 1 de Mzo. de 2022
Walter Roberson
el 1 de Mzo. de 2022
Good point.
Most of the time I use Edgecolor 'none' to avoid that problem
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!