grouped scatter on geographical axes

5 ビュー (過去 30 日間)
Bruno Martinico
Bruno Martinico 2020 年 11 月 3 日
回答済み: Bruno Martinico 2020 年 12 月 1 日
I need to scatter a points dataset on geographical axes, but I need also to group scatter points so that I can set group properties. In particular for each group I need to set different markerfacecolor and marckeredgecolor.
gscatter function can't be plotted on geoaxes so my figure is deformed, but can have colors that I define.
geoscatter function do not allow grouping scatter points but points are not deformed.
How can I resolve?
I attached an example on a png file.
Thanks for answer.

採用された回答

Tarunbir Gambhir
Tarunbir Gambhir 2020 年 12 月 1 日
Since the geoscatter function does not support grouping, I suggest you segregate/group the data points manually before plotting. Then use geoscatter to plot every group with their unique properties.

その他の回答 (1 件)

Bruno Martinico
Bruno Martinico 2020 年 12 月 1 日
Thankyou! I do not know if it is the less expensive, but I found the following way:
In M_IDPs2 are my points, and it is a (numberofpoints, 3) matrix. Columns: lat, lon, I.
A for loop on "I", that are possible group labels of points stored in M_IDPs2 (I do not know/choose a-priori for points the values of the interval 1:0.5:11 because they are an output of a calculus). I look for points for each "I" with find and only when I find them I store them in M_scatgroup and plot them. fMarkFaceCol(I) and fMarkEdgeCol(I) are external functions I defined to choose proper colors inside the loop iterations.
for I=1:0.5:11
c3=find(M_IDPs2(:,3)==I);
if (~isempty(c3))
M_scatgroup=M_IDPs2(c3,:);
gs=geoscatter(gx,M_scatgroup(:,1),M_scatgroup(:,2),[],[1 0 1],'o');
gs.MarkerFaceColor=fMarkFaceCol(I);
gs.MarkerEdgeColor=fMarkEdgeCol(I);
gs.DisplayName=num2str(I);
hold on
lgd=legend;
lgd.AutoUpdate='on';
end
end

カテゴリ

Help Center および File ExchangeGeographic Plots についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by