Surround color for display
Show older comments
When I create a display using pcolor of data that is contained within a circle I insert NaN values in all locations not within the circle and then the display creates white areas where the NaNs are located. Is there any way I can get this same effect but have the surround black instead of whiite?
Accepted Answer
More Answers (1)
Image Analyst
on 15 Jun 2022
0 votes
Why not just write 0's to those pixels instead of NaNs?
4 Comments
Charles Campbell
on 15 Jun 2022
Image Analyst
on 17 Jun 2022
Why would that be? Do you have an indexed image? If so just assign the value to the value in the colormap that is black.
Charles Campbell
on 17 Jun 2022
Image Analyst
on 17 Jun 2022
I did think of that, or something like that. It really doesn't matter if the matrix values represent an intensity like a regular gray scale image or a height or elevation. I was thinking values were brightness but they just as well could have been elevation. That's why I suggested using a colormap and it looks like you found a working solution using that. You should also look at the function clim (r2022a or later) or caxis (r2021b or earlier).
But @DGM presented an alternative way and it looks like you preferred that way since you accepted the answer.
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
