plotting colorcoded points on a map

1 次查看(过去 30 天)
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 中查找有关 Mapping Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by