How to apply one colormap to multiple ocean colour subplots

10 views (last 30 days)
Hello everyone,
I am plotting multiple satellite ocean colour images and would like to plot 4 of them in one figure. My problem is that when I plot them my subplots lose the colour. Can someone point out what I'm doing wrong and suggest fixes?
I put 2 as an example for my plotting code. sst1 and sst2 are variables.
The m_proj, m_pcolor and other m_ functions are from the m_map toolbox: https://www.eoas.ubc.ca/~rich/map.html
figure(1);
%Summer
subplot(2,2,1)
hold on
m_proj('mercator','lat',[south north],'lon',[west east]);
set(gcf,'Position',[200 100 900 800])
set(gcf,'PaperPositionMode','auto')
m_pcolor(lon,lat,sst1);
shading interp;
colorbar;
colormap(jet)
m_usercoast('gshhs_h_AUSNZ','patch',[.6 .6 .6]);
m_grid('box','on','tickdir','in','linestyle','none');
set(gca,'fontsize',14);
caxis([0.05 1])
title('22 Feb 2011, Summer')
hold on
%Autumn
subplot(2,2,2)
hold on
m_proj('mercator','lat',[south north],'lon',[west east]);
set(gcf,'Position',[1300 100 900 800])
set(gcf,'PaperPositionMode','auto')
m_pcolor(lon,lat,sst2);
shading interp;
colorbar;
%colormap(jet)
m_usercoast('gshhs_h_AUSNZ','patch',[.6 .6 .6]);
m_grid('box','on','tickdir','in','linestyle','none');
set(gca,'fontsize',14);
caxis([0.05 1])
title('26 March 2011, Autumn')
hold on
And what my current actually plot looks like. I am able to get full colored image when I plot one of them
Thank you
  2 Comments
dpb
dpb on 9 May 2023
What are all the m_xxxx functions? I don't find any such names in the documentation. Looks like somewhere in there would be the answer.
Nobody here can try to duplicate an issue without a data file and other info on what those are. Are you using some third-party toolbox, maybe?
Shuhao Lim
Shuhao Lim on 9 May 2023
Yes those functions are from a third-party toolbox M_Map. I think it solves some problems with plotting ocean data.

Sign in to comment.

Answers (1)

dpb
dpb on 9 May 2023
This is not a MATLAB problem, per se, since you're using the <M_Map Application>.
Only someone else with the package installed has any chance at all of helping; your best chance is to find whatever support network there is for the application. I didn't see anything at the link about such other than an email address for the original author; whether it is still active and whether the app is continuing to be supported I couldn't find anything to confirm one way or another. It does appear nothing has happend since 2021, however, which could well indicate the author has moved on to other things...
In the section in the doc at the above link on <known Bugs/Problems>, however, it does mention quite a number of issues were uncovered during development with rendering filled contours, and there have been a lot of changes in internal MATLAB HG since 2021, so depending upon the release you're using, what might have worked with the last releases used for development/testing may not work with more recent releases.
That's what you get with third-party app's; it's up to them to continue to support or on the user if they walk away...
  2 Comments
dpb
dpb on 9 May 2023
ADDENDUM: Searched the doc to see if could find a reference to latest version(s) of MATLAB used; no references were given other than has to be >V5.1, but I did find the following section about using the MATLAB colorbar that you may find useful <Contours and Colorbars>
Shuhao Lim
Shuhao Lim on 13 May 2023
Hi @dpb, thank you very much for finding the documentation to help me. I've checked and realised that my issue was not with the m_proj toolbox, but I've used ncread incorrectly--my sst data was not being read.
Thanks for taking the time to help me work out this!

Sign in to comment.

Products


Release

R2021a

Community Treasure Hunt

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

Start Hunting!