How to ignore NaN values in pcolor function?
9 views (last 30 days)
Show older comments
I have three data lati, long, CaCO3. The size of each data is 180x1, 180x1, 180x180. lati and long don't have NaN values but CaCO3 have.
A part of CaCO3 matrix is
CaCO3 =
86.4195 88.6516 87.6645 NaN NaN
90.9402 89.1650 89.9154 NaN NaN
87.4232 94.4415 87.3036 91.3506 90.5179
NaN NaN NaN NaN NaN
NaN NaN NaN NaN NaN
NaN 91.5944 NaN NaN NaN
NaN 88.8381 87.1006 NaN NaN ......
NaN 89.5835 NaN NaN NaN
NaN 89.5548 NaN NaN NaN
87.2730 95.8932 87.5370 91.7358 91.7450
87.9113 96.3841 88.3516 89.7063 90.6103
89.8246 92.2127 90.4637 91.2455 92.1979
90.9599 93.2109 90.6547 97.5123 97.5610
When I used pcolor(long,lati.CaCO3), the result was a picture below. I think black lines represent because of NaN values, so how to ignore NaN values?
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/157724/image.png)
0 Comments
Accepted Answer
Daniel kiracofe
on 6 Nov 2016
I don't think the black lines are because of the NaNs. Its coming from the default shading method, which is faceted. Try "shading flat" or "shading interp".
https://www.mathworks.com/help/matlab/ref/shading.html
More Answers (0)
See Also
Categories
Find more on Geographic Plots 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!