![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173462/image.png)
Color area outside of polygon/shapefile?
조회 수: 19 (최근 30일)
이전 댓글 표시
Hi,
I have a shapefile of the U.S.. I am simply looking to fill the outside of this shapefile with a particular color. I'm sure there is a simple solution but cannot find..
Thank you!
댓글 수: 0
답변 (2개)
Chad Greene
2016년 3월 9일
Hi Ryan,
Perhaps you're looking for setm with the 'ffacecolor' option.
worldmap('world')
geoshow('landareas.shp')
setm(gca,'ffacecolor',rgb('ocean blue'))
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/173462/image.png)
댓글 수: 8
Chad Greene
2016년 4월 11일
If you have a shapefile, you can simply determine which pixels in your lat/lon grid fall within the bounds of the shapefile's polygon using inpolygon. If your shapefile contains multiple polygons, use Kelly Kearney's inpolygons.
Erin Browne
2019년 3월 19일
Hi I am wondering instead of setting the ocean color how would you do that for the land masses?
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!