Why does using PATCH with transparency cause the axes to disappear in MATLAB?

조회 수: 1 (최근 30일)
If I use the following code, the X axis disappears when transparency is used :
t = linspace(0,2*pi,128);
y1 = 5*cos(t);
y2= 10*sin(t);
plot(t,y1,'b')
hold on
area(y2,t)
alpha(0.5)
If I do not create a line plot, then the Y axis disappears:
t = linspace(0,2*pi,128);
y2= 10*sin(t);
area(y2,t)
alpha(0.5)

채택된 답변

MathWorks Support Team
MathWorks Support Team 2021년 2월 24일
편집: MathWorks Support Team 2021년 3월 2일
This has been verified as a bug in MATLAB 6.5 (R13) and later versions in the way that axes are rendered in hardware accelerated OpenGL, when transparency is used.
There are currently no known fixes to the bug itself, but there are a couple workarounds.
1. Set the OpenGL renderer to use software acceleration instead of the hardware acceleration.
opengl software
The disadvantage of this method is that with resource intensive figures, software acceleration may be slower compared to hardware acceleration. Please refer to the OpenGL renderer documentation for more info.
2. Update graphics card drivers or try a different graphics card. Older driver versions may or may not work. A solution is not guaranteed.

추가 답변 (1개)

Adam Danz
Adam Danz 2017년 7월 30일
I've been dealing with this bug on matlab vs 2014a for a few days and wanted to share my solution.
My code was setting transparency (alpha) of objects in a plot and then setting axis limits. The axes disappeared after setting the axis limits. I changed the order of these commands so that axis limits were set before setting transparency. This fixed the problem for all of my subplots that were affected by this bug. Hope that helps.
Adam Danz

카테고리

Help CenterFile Exchange에서 Lighting, Transparency, and Shading에 대해 자세히 알아보기

제품


릴리스

R2011a

Community Treasure Hunt

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

Start Hunting!

Translated by