Filling a white space in plot with another color

4 ビュー (過去 30 日間)
Róbert Straka
Róbert Straka 2021 年 3 月 16 日
コメント済み: Róbert Straka 2021 年 3 月 16 日
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.

採用された回答

Rik
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')
  1 件のコメント
Róbert Straka
Róbert Straka 2021 年 3 月 16 日
Works like a charm, thank you.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraphics Objects についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by