Filling a white space in plot with another color
5 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Rik
2021-3-16
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')
更多回答(0 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!