M_map file with contourf

12 Ansichten (letzte 30 Tage)
Jonathan Demmer
Jonathan Demmer am 31 Aug. 2022
Kommentiert: Bjorn Gustavsson am 31 Aug. 2022
Hi all,
I am using M_map to create a figure of Indonesian waters. As you can notice on the figure below (too heavy to upload as matlab fig...), the waters with a depth below 1000 m are in white. I would like to have the water below 1000 in darblue then a decrease of colour for shalower water as presented on hte legend. I think it has something to do with contourf but I tried different code and i am stuck... Can someone help me please?
Cheers
% add path to matlab functions:
addpath ('C:\Matlab_download\m_map1.4\m_map\');
% Coordinates of all Indonesia
% 'lon',[90 146.64],'lat',[-12 14.15]);
m_proj('lambert','long',[90 146.64],'lat',[-12 14.15]);
[CS,CH]=m_etopo2('contourf',[-1000:100:0 ],'edgecolor','none');
m_gshhs_f('patch',[.7 .7 .7],'edgecolor','none');
m_grid('linest','none','tickdir','out','box','fancy','fontsize',16);
colormap(m_colmap('blues'));
caxis([-1000 000]);
[ax,h]=m_contfbar([.55 .75],.8,CS,CH,'endpiece','no','axfrac',.05);
title(ax,'meters')
set(gcf,'color','w');

Akzeptierte Antwort

Bjorn Gustavsson
Bjorn Gustavsson am 31 Aug. 2022
You might get away by modifying the colormap with the brighten function, perhaps something like:
brighten(-0.5)
This should change the colours giving a more blue (if I got it right) appearance than the default m_colmap('blues') give. You could also directly modify that colourmap as you see fit:
mblues = m_colmap('blues');
mblues = mblues.^4; % any modification you see fit that leaves the values between 0 and 1...
colormap(mblues)
HTH
  2 Kommentare
Jonathan Demmer
Jonathan Demmer am 31 Aug. 2022
Hi,
First thank you for your answer. Thi idea is not to make it more blue, the idea is to make the area in white (deeper than 1000m) darkblue. i think it must comefrom contourf which makes darblue depth from -1000 to -900 but i would like the area deeper than -1000 to be also in dark blue.
Is it clearer?
Bjorn Gustavsson
Bjorn Gustavsson am 31 Aug. 2022
Then perhaps you shouldn't limit contourf to -1000, so maybe this:
[CS,CH]=m_etopo2('contourf',[-10000,-1000:100:0 ],'edgecolor','none');
% -10000 should be safe to include all deeper parts?

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by