Geoscatter plot with different colors
20 ビュー (過去 30 日間)
古いコメントを表示
Hi everyone!
I am trying to do some plotting wit geographical data.
So I've got Latitude and Longitude, which I want to plot on a map; the third data is a dataset consistion of 0s and 3s. (All Arrays have the same length) So always when its a 3 it sould be green and always when its 0 it should be red.
Could you please help me.
My first try was this:
LockNo = find(Lock == 0)
LockFull = find(Lock==3)
plot(x(LockNo),y(LockNo),'r.',x(LockFull),y(LockFull),'g.');
Thank you in advance!
0 件のコメント
回答 (1 件)
Walter Roberson
2021 年 8 月 3 日
dot_color = repmat([1 0 0], length(Lock), 1);
dot_color(Lock == 3, :) = [0 0 1];
lat = y; long = x;
pointsize = 20;
scatterm(lat, long, pointsize, dot_color)
or
cmap = [1 0 0; 0 0 0; 0 0 0; 0 0 1];
lat = y; long = x;
pointsize = 20;
scatterm(lat, long, pointsize, cmap(Lock+1,:));
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Geographic Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!