Filling a white space in plot with another color
5 views (last 30 days)
Show older comments
Hello guys,
just want to ask if it is possible to change the white color in plot
to look something like this (it was filled in MS Paint so don't mind the "stairs" efect)
I tried to look on the internet but found nothing about it. Just want to know if it is even possible to do something like this.
0 Comments
Accepted Answer
Rik
on 16 Mar 2021
It is not possible in a direct way, but you can do things with patch to get a similar result:
t=linspace(0,5*pi,1000);
y=abs(sin(t));
plot(t,y)
ylim([0 1.1])
lims=axis;
x_area=[t lims(2) lims(2) lims(1) lims(1) t(1)];
y_area=[y lims(3) lims(4) lims(4) lims(3) y(1)];
hold on
patch(x_area,y_area,'k')
More Answers (0)
See Also
Categories
Find more on Graphics Objects 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!