how to set NaN values red in a figure ?

조회 수: 3 (최근 30일)
BN
BN 2019년 10월 14일
답변: dpb 2019년 10월 14일
Hi, How to set all NaN values red color in the code below? ( I want to see NaN part as red color in output)
Mean_precip= nanmean(new_precipitation, 3); % average of all months
surf(loni, lati, Mean_precip(:,:,:).'); view(2)
axis xy
[Loni2,Lati2] = meshgrid(loni,lati);
%shading interp
cmocean 'rain' % rainy to dry colormap
xlabel longitude
ylabel latitude
[Lati2,Loni2,newpreceip,Mean_precip] = recenter(Lati2,Loni2,newpreceip,Mean_precip);
hold on
borders('countries','color',rgb('dark gray'))
cmocean 'rain'
cb = colorbar;
cb.Label.String = 'Average Precipitation (mm/m)';
xlabel longitude
ylabel latitude
title ('Precipitation (Monthly Average from 1982 to 2015)')

채택된 답변

dpb
dpb 2019년 10월 14일
I guess you could interpolate to fill in the NaN locations and then scatter3 them on top of the surf w/ the red marker...otherwise, what value would you use to plot with?
W/O a dataset to play with, it's hard to visualize just what is going to happen here...or what you have in mind the result should look like...

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 NetCDF에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by