How to change plot background color for some datapoints?
19 ビュー (過去 30 日間)
古いコメントを表示
I would like to produce a plot as shown below. The feature I am looking are the different background colors for some of the datapoints. How can I do this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/159995/image.png)
Thank you!
0 件のコメント
採用された回答
Walter Roberson
2016 年 4 月 4 日
You can use rectangular regions with fill(), or you can use rectangle() with a FaceColor . Either way, you can draw those background areas first, or if you draw them after the plot be sure to uistack() them to the beneath the plot lines.
5 件のコメント
Claire Andreasen
2020 年 8 月 17 日
if you're using a grid, how would you make the grid appear overtop the rectangle?
Walter Roberson
2020 年 8 月 17 日
Grids are considered part of an axes. You can have axes appear on top by setting the axes Layer property to 'top' instead of the default 'bottom'
参考
カテゴリ
Help Center および File Exchange で Surface and Mesh Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!