Why alpha transparency property has a bug below y-axis value zero?
1 view (last 30 days)
Show older comments
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 Comment
Supreeth Subbaraya
on 14 Aug 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')
Answers (0)
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!