Changing 'FaceAlpha' on a Patch changes the plot

4 views (last 30 days)
I was trying to highlight certain periods during a day by putting a semi-transparent patch in the background of the plot, and noticed that adjusting the FaceAlpha property in the patch from '1' changes the whole plot. Specifically I noticed that the edges of the patch no longer matching the specified edges in the patch command, also the colors of other lines are changed.
Anyone know why this is, or what to do to fix it.
Here's an example:
>> x = datenum(now-1):1/1440:now;
>> y = sin(x*10);
>> figure;plot(x,y)
>> patch([now-.75 now-.25 now-.25 now-.75],[.4 .4 .6 .6],'r')
>> chil = get(gca,'Children');
Produces a sinusodal plot with a small red patch.
>> set(chil(1),'FaceAlpha',.1)
Causes the line to become very digitized
>> set(chil(1),'FaceAlpha',1)
Returns it to normal.

Answers (1)

Sean de Wolski
Sean de Wolski on 1 Nov 2012
This is probably because the 'Renderer' was not OpenGL before you set the transparency. Since OpenGL is the only renderer that supports transparency, it switches to this and causes other things to look slightly different.

Products

Community Treasure Hunt

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

Start Hunting!