how to set NaN values red in a figure ?

1 次查看(过去 30 天)
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 个)

Community Treasure Hunt

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

Start Hunting!

Translated by