Why alpha transparency property has a bug below y-axis value zero?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I need to plot two different area object, originated from two different sets of data, in the same plot. To make them visible I need to have transparency, but if I use the alpha property I obtain a different shade of color for the same area under the 0 value of the y-axis.
Can someone help me solving this problem?
A=area(X (Y-X))
alpha .5 set(gca,'Layer','top') set(A(1),'FaceColor',[1 1 1]) set(A(2),'FaceColor',[.7 .9 .1]) set(A,'LineStyle','none')
X and Y are vectors.
Thanks
1 commentaire
Supreeth Subbaraya
le 14 Août 2014
If X and Y are vectors, then "set(A(2),'FaceColor',[.7 .9 .1])" would result in an error because index in A(2) would exceed the matrix dimensions. So I think they cannot be vectors. Please let us know the type of data you are using. I tried the following code. I could see that the transparency was applied to both the layers and not to a single layer. So the color changes and it is expected. Is this the issue you are facing?
X = [1:4; 1:4]'
Y = exp(X);
A=area(X,(Y-X))
alpha .5
set(gca,'Layer','top')
set(A(2),'FaceColor',[.7 .9 .1])
set(A,'LineStyle','none')
Réponses (0)
Voir également
Catégories
En savoir plus sur Lighting, Transparency, and Shading dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!