grouped scatter on geographical axes

5 visualizzazioni (ultimi 30 giorni)
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.

Risposta accettata

Tarunbir Gambhir
Tarunbir Gambhir il 1 Dic 2020
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.

Più risposte (1)

Bruno Martinico
Bruno Martinico il 1 Dic 2020
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

Categorie

Scopri di più su Geographic Plots in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by