Spatial plot land part in gray color

5 visualizzazioni (ultimi 30 giorni)
Joydeb Saha
Joydeb Saha il 21 Gen 2025
Commentato: Austin M. Weber il 21 Gen 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 Commenti
Mathieu NOE
Mathieu NOE il 21 Gen 2025
hello
can you provide corr_coeff_weak data ?
Austin M. Weber
Austin M. Weber il 21 Gen 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')

Accedi per commentare.

Risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by