필터 지우기
필터 지우기

How do I overlay worldmap outlines onto an imagesc plot?

조회 수: 7 (최근 30일)
Rochelle Parker
Rochelle Parker 2021년 7월 1일
답변: Chunru 2021년 7월 2일
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)

답변 (1개)

Chunru
Chunru 2021년 7월 2일
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!

Translated by