Why alpha transparency property has a bug below y-axis value zero?

1 次查看(过去 30 天)
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 个评论
Supreeth Subbaraya
Supreeth Subbaraya 2014-8-14
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')

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by