How can I shade the areas when xy<0?

1 view (last 30 days)
People much smarter than me,
I'm using the code below and want to only shade the areas in quadrants II & IV, where xy<0. Does anyone have any ideas on how to limit the shading to those regions?
Thanks for all your help, the code is below:
fig=fig+1;
figure(fig); hold on; box on; grid on
set(gcf,'Position',[0 0 5 5])
t = linspace(0, 2*pi, 200);
x = cos(t);
y = sin(t);
H=area(x,y);
h=get(H,'children');
set(h,'FaceAlpha',0.5);

Accepted Answer

Walter Roberson
Walter Roberson on 24 Sep 2013
fill on angle pi/2 to pi, and 3*pi/2 to 2*pi, with the appropriate axis portions as straight lines.
By the way you might want to linspace() 201 points instead of 200

More Answers (0)

Categories

Find more on Mathematics 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!