Why does FaceAlpha affect ZData of different object?
Show older comments
Hi,Im working with matlab 2015a in linux.
trying this code (with the slice grid ,x and y in the mat file attached)
if true
clear
clc
load('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?
Accepted Answer
More Answers (2)
Vivek Jadye
on 23 Nov 2015
2 votes
This issue is fixed in MATLAB R2015b.

The root cause of the problem is the fact that, in absence of a global anti-alising technique, modern OpenGL drivers draw smooth round points by introducing a translucent halo at the periphery of points during rasterization; and this translucent region was being blended with an incorrect background. This means that we need to be extra careful while drawing points because even the points with opaque colors may still need blending with the correct background.
Walter Roberson
on 4 Aug 2015
0 votes
I have not run your code, but the most common problem when you use Alpha values is that it forces the OpenGL renderer to be used, which can result in different appearances than the other renderers.
Also as of R2014b some of the rendering details have changed. See http://www.mathworks.com/help/matlab/graphics_transition/why-are-some-components-missing-or-partially-obscured.html
Categories
Find more on Graphics Performance in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

