map appear is white

3 visualizzazioni (ultimi 30 giorni)
NOORASHIEKIN KHALID
NOORASHIEKIN KHALID il 2 Mar 2022
Risposto: Bhanu Prakash il 17 Ott 2023
Hi everyone and good day,
I'm stuck when the contourm code doesn't work to colour my map (see image below).
Can someone help me?. Here is my command script:
>> ncdisp('https://coastwatch.pfeg.noaa.gov/erddap/griddap/erdHadISST')
>> time = ncread('https://coastwatch.pfeg.noaa.gov/erddap/griddap/erdHadISST','time');
>> time_ymdhms = datevec(time/86400 + datenum([1970 1 1 0 0 0]));
>> lat = ncread('https://coastwatch.pfeg.noaa.gov/erddap/griddap/erdHadISST’,'latitude');
>> lon = ncread('https://coastwatch.pfeg.noaa.gov/erddap/griddap/erdHadISST','longitude');
>> lon_aoi = find(lon >= 70 & lon <= 100);
>> lat_aoi = find(lat >= -20 & lat <= 0);
>> time_aoi = find(time_ymdhms(:,1) == 2009 & time_ymdhms(:,2) == 1);
>> aoi_start = [lon_aoi(1) lat_aoi(1) time_aoi(1)];
>> aoi_span_year = [length(lon_aoi) length(lat_aoi) 12];
>>sst_year=ncread('https://coastwatch.pfeg.noaa.gov/erddap/griddap/erdHadISST’,'sst',aoi_start,aoi_span_year);
>> med_sst = nanmedian(sst_year,3);
>> figure
axesm('mercator','MapLatLimit',[-20 0],'MapLonLimit',[70 100],'MeridianLabel','on','ParallelLabel','on','MLabelLocation',70:2:100,'PLabelLocation',-20:2:0,'MLabelParallel','south');
>> contourm(lat_aoi,lon_aoi,med_sst','fill','on','LevelStep',0.01);
>> title(sprintf('Monthly SST %s - %s', datestr(time_ymdhms(time_aoi,:),'mmm-yyyy'),datestr(time_ymdhms(time_aoi+11,:),'mmm-yyyy')));
>> colormap(jet);
>> caxis([25 30]);
>> c = colorbar;
>> c.Label.String = 'SST (degree)';
>> geoshow('landareas.shp','FaceColor',[0.5 0.5 0.5]);
>> tightmap

Risposte (1)

Bhanu Prakash
Bhanu Prakash il 17 Ott 2023
Hi Noorashiekin,
I understand that you want to know why the map acquired is white even though you have used the FaceColor’ argument, in ‘geoshow’ function, to colour the map grey.
The reason for the map being white is because of the latitude and longitude limits, which are (-20,0) and (70,100) respectively. For the limits provided, the contour plot is accurate.
To gain a better understanding of how a contour plot varies with different limits, consider the following code snippets:
%setting the limits
worldmap([-20 0],[70 100])
%plotting the map data
geoshow('landareas.shp','FaceColor',[0.5 0.5 0.5])
To obtain a different contour plot, you can change the limits as follows:
%setting the limits
worldmap([-40 30],[50 160])
%plotting the map data
geoshow('landareas.shp','FaceColor',[0.5 0.5 0.5])
To set the latitude and longitude limits, you can use the ‘worldmap’ function in MATLAB. For more information on the ‘worldmap’ function, refer to the following documentation:

Prodotti


Release

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by