plotting colorcoded points on a map

조회 수: 2 (최근 30일)
Darragh Kenny
Darragh Kenny 2018년 10월 24일
댓글: Darragh Kenny 2018년 10월 24일
Hi,
I am trying to plot significant trends in the standard precipitation evaporation index onto a map of Zimbabwe. So far, I am only showing positive and negative trends, but I would like to have a colorcode on each point signifying the magnitude. How do I do that?
clear all;
SPEI12=dlmread('SPEI12_zimbabwe.txt');
gridZim=load('gridZim.mat');
gridZim=struct2cell(gridZim);
gridZim=gridZim{1};
temp=regexp(gridZim,'\d{1,8}','match'); %here I'm just reading out the gridpoints
for i=1:length(gridZim)
gridpoints(:,i)=str2double(temp{i});
long_lat(i,:)=[gridpoints(1,i)+0.01*gridpoints(2,i) -gridpoints(3,i)-0.01*gridpoints(4,i)];
end
for i=1:length(SPEI12(1,:))
[taub(i) tau(i) h(i) sig(i) Z(i) S(i) sigma(i) sen(i) n(i) senplot(i) CIlower(i) CIupper(i) D(i) Dall(i) C3] = ktaub([SPEI12(:,i) [1:1345].'], 0.05, 0); %checking for significant trends with Mann-Kendall and quantifying the trend with Sen's slope
end
worldmap('Zimbabwe');
bordersm
hold on
long=long_lat(find(h==1),1); %h==1 signifies a significant trend. I just want to plot the gridpoints with a significant trend
latit=long_lat(find(h==1),2);
sen_s=sen(find(h==1));
for i=1:length(sen_s)
if sen_s(i)<0
plotm(latit(i),long(i),'bp')
end
if sen_s(i)>0
plotm(latit(i),long(i),'rp')
end
end
m=worldmap('Zimbabwe');
bordersm
hold on
plotm(long_lat(:,2),long_lat(:,1),sen.') %this is not working

채택된 답변

jonas
jonas 2018년 10월 24일
편집: jonas 2018년 10월 24일
Try this:
scatterm(long_lat(:,2),long_lat(:,1),[],sen_s)
I assume sen_s is the variable you want colorcoded. Adapt the colormap per your preferences.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics and Visualization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by