Make background of half plot red

I have the following plot
untitled.png
I want the plot background over the yellow line to have a color, e.g. red, to show that this is the "bad" region.
Thanks for any suggestions!

回答(1 个)

Try this:
figure
plot(rand(3)*0.3, rand(3)*0.3, 'x') % Plot Points
hold on
plot([0 5], [0 5], 'Color',[0.8 0.5 0.1]) % Plot Line
patch([0 5 5 0], [0 5 5 5], 'r', 'FaceAlpha',0.25, 'EdgeColor','none') % Plot Region Above Line
hold off
Experiment to get the result you want.
Make background of half plot red - 2019 08 26.png

类别

在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息

产品

版本

R2019a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by