grouped scatter on geographical axes

4 Ansichten (letzte 30 Tage)
Bruno Martinico
Bruno Martinico am 3 Nov. 2020
Beantwortet: Bruno Martinico am 1 Dez. 2020
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.

Akzeptierte Antwort

Tarunbir Gambhir
Tarunbir Gambhir am 1 Dez. 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.

Weitere Antworten (1)

Bruno Martinico
Bruno Martinico am 1 Dez. 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

Kategorien

Mehr zu Geographic Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by