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

조회 수: 1 (최근 30일)
Silvia
Silvia 2014년 8월 14일
댓글: Supreeth Subbaraya 2014년 8월 14일
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에서 Surface and Mesh Plots에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by