Spatial plot land part in gray color

5 Ansichten (letzte 30 Tage)
Joydeb Saha
Joydeb Saha am 21 Jan. 2025
Kommentiert: Austin M. Weber am 21 Jan. 2025
I am plotting a spatial plot, I want land parts should be in gray or white colour. The code I am attaching is not working
figure;
imagesc(lon, lat, corr_coeff_weak');
set(gca, 'YDir', 'normal');
colorbar;
colormap(redblue);
caxis([-1 1]);
xlabel('Longitude');
ylabel('Latitude');
title('Correlation for Weak SST Years');
hold on;
load coastlines;
fill(wrapTo360(coastlon), coastlat, 'w', 'EdgeColor', 'none'); % Fill land with white
plot(wrapTo360(coastlon), coastlat, 'k.', 'MarkerSize', 4);
axis xy;
  2 Kommentare
Mathieu NOE
Mathieu NOE am 21 Jan. 2025
hello
can you provide corr_coeff_weak data ?
Austin M. Weber
Austin M. Weber am 21 Jan. 2025
Have you tried plotting your data using a map axes instead? With the axesm function you can specify to plot longitudes from 0 to 360 instead of -180 to +180. For example:
load coastlines
figure;
axesm('Robinson','MapLonLimit',[0 360])
fillm(coastlat,coastlon,'FaceColor','#505050','EdgeColor','none')
framem
gridm
box off
set(gca,'YColor','none','XColor','none')

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Mapping Toolbox finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by