Why does using PATCH with transparency cause the axes to disappear in MATLAB?
Show older comments
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)
Accepted Answer
More Answers (1)
Adam Danz
on 30 Jul 2017
1 vote
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
Categories
Find more on Graphics Performance in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!