Coloring different parts in a plot with different color
1 次查看(过去 30 天)
显示 更早的评论
Hi,
I have the following plot and I want to color the complete area where red data are present with a different color as compared to the area where blue data are present. Is there any way to do it? I tried with fill and area functions but no luck. Can anyone please help me with this?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/160375/image.png)
4 个评论
Walter Roberson
2017-2-4
Note that your convex hulls can overlap. boundary() can overlap as well but the risk is lower
采纳的回答
Walter Roberson
2017-2-4
编辑:Walter Roberson
2017-2-4
You can select the appropriate points, boundary() them, use that to extract an ordered subset of the original points. fill() using those x and y position.
2 个评论
Image Analyst
2017-2-4
How do you decide whether to fill an area using fill(), patch(), or area()? What's the difference between them? When would you use each instead of the others?
Walter Roberson
2017-2-4
area fills between a given y and the y=0 axis.
fill is a front end for patch.
fill creates a filled polygon by calling patch
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!