Hi,Im working with matlab 2015a in linux.
trying this code (with the slice grid ,x and y in the mat file attached)
if trueclearclcload('FaceAlpha.mat'); % Loading SliceGrid and X,Y parametrs
hold on; xlabel('X'), ylabel('Y'), zlabel('Z'); axis equal;axis image; plot(SliceGrid.x(X),SliceGrid.y(Y),'blue.');hold on;h=[-8 -0.5 0.5 1]v=[7 4 4 7];fill_2=fill(h,v,'blue'); % Creating blue object
x=[0 -0.5 0.5 1]y=[9 4 4 9];fill_1=fill(x,y,'red');% Creating red object
t=[-2 -0.5 0.5 2]z=[9 2 2 0];fill_3=fill(t,z,'yellow'); % Creating yellow object
%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%set(fill_1,'FaceAlpha',0.5); % After this line everthing is ok.
set(fill_2, 'ZData', repmat(10, size(get(fill_2, 'XData')))); % After this line the outside blue plot is damaged
%%%%%%%%%%%% - as you can see in the above figure
%%%%%%%%%%%%if we omit the line -> set(fill_1,'FaceAlpha',0.5);
%%%%%%%%%%%%and leave the code with the ZData property, the outside blue plot doesn't damaged.
%%%%%%%%%%%%if we omit the line -> set(fill_2, 'ZData', repmat(10, size(get(fill_2, 'XData'))));
%%%%%%%%%%%%and leave the code with the FaceAlpha property, the outside blue plot doesn't damaged.
end
why and how does face alpha affect other object with ZData? and why are they doesn't work together? what is wrong?
Best Answer