grouped scatter on geographical axes

5 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Geographic Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by