scatter map with different markers

I tried to make a map indicating several network sites around the globe. See the figure below for example. I tried 'scatterm' but it doesn't allow different marker. Anyone knows how to achieve that with MatLab? And also how would the legend be made?

 採用された回答

dpb
dpb 2021 年 8 月 16 日

0 投票

Call scatter once for each group with the chosen marker; save the handle array to the scattergroup objects returned. legend will associate the legend text with each in turn or you can use the 'DisplayName' property when drawing each.

3 件のコメント

Hannah
Hannah 2021 年 8 月 16 日
編集済み: Hannah 2021 年 8 月 16 日
Can 'scatter' be drawn on a map? I use 'scatterm' and it seem doesn't allow changing marker
Kelly Kearney
Kelly Kearney 2021 年 8 月 16 日
Yes, scatterm accepts very similar inputs to the scatter function.
lt1 = rand(10,1)*180 - 90;
ln1 = rand(10,1)*360;
lt2 = rand(10,1)*180 - 90;
ln2 = rand(10,1)*360;
worldmap('world');
hs(1) = scatterm(lt1, ln1, [], 'm', 'o', 'filled', 'markeredgecolor', 'k');
hs(2) = scatterm(lt2, ln2, [], 'g', 's', 'filled', 'markeredgecolor', 'k');
legend(hs, 'one', 'two');
Hannah
Hannah 2021 年 8 月 17 日
Thank you, Kelly, for this example!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2021 年 8 月 16 日

コメント済み:

2021 年 8 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by