Clear Filters
Clear Filters

How do I overlay worldmap outlines onto an imagesc plot?

7 views (last 30 days)
I'm basically trying to get the end product to be the imagesc plot with country outlines on top of it. I'm not sure the best way to do it, but this is not working. Is there a way to do this?
% define and generate color plot
x = [-180:5:180];
y = [10 5 0 -5 -10];
d1 = rand(5,73);
d2 = floor(d1 * 5);
imagesc(x, y, d2)
colorbar
% define and generate worldmap with coastlines and hold the previous plot on
hold on
worldmap([-80 80],[-180 180])
load coast
geoshow(lat, long)

Answers (1)

Chunru
Chunru on 2 Jul 2021
You can use pcolorm instead of imagesc:
% define and generate color plot
x = [-180:5:180];
y = [10 5 0 -5 -10];
d1 = rand(5,73);
d2 = floor(d1 * 5);
%imagesc(x, y, d2)
colorbar
% define and generate worldmap with coastlines and hold the previous plot on
hold on
worldmap([-80 80],[-180 180])
load coast
geoshow(lat, long)
pcolorm(y, x, d2) % lat lon, zdata

Community Treasure Hunt

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

Start Hunting!