Make background of half plot red
显示 更早的评论
I have the following plot

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 个)
Star Strider
2019-8-26
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.

类别
在 帮助中心 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!