How to add back borderline of my figure.

2 views (last 30 days)
HKmathfin
HKmathfin on 30 Jan 2012
Here is my code. When I add last sentence alpha(0.5), the borderline of my figure disappear somehow? I mean the upper and left borderline disappear, how do I add it back? Many thanks
figure(1);
x = -4:8;
y = x.^3;
upper = x.^3-30;
lower = x.^3+30;
plot(x,upper,x,y,x,lower);
hold on;
fill([x fliplr(x)],[y fliplr(upper)],[1 0 0]);
fill([x fliplr(x)],[y fliplr(lower)],[1 0.75 0]);
% alpha(gcf,0.5);
x1 = 1:2;
Ylim = get(gca,'YLim');
y1 = ones(1,length(x1)).*Ylim(1);
y2 = ones(1,length(x1)).*Ylim(2);
fill([x1 fliplr(x1)],[y1 fliplr(y2)],[1 0 0]);
alpha(0.5);

Answers (1)

Walter Roberson
Walter Roberson on 30 Jan 2012
This is a long-standing bug; there is a work-around but no cure for it.
I do not remember the detail of the bug, and I am having trouble locating the appropriate posting, but I remember that Jan knows the details.
  2 Comments
HKmathfin
HKmathfin on 30 Jan 2012
Where is the workaround? Or can you forward this to Jan? Thanks a lot.
Walter Roberson
Walter Roberson on 30 Jan 2012
The work-around involved making the axes just a tiny bit bigger, I think.

Sign in to comment.

Categories

Find more on Interactive Control and Callbacks 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!