How can I label multiple routes on a geoscatter plot?

3 ビュー (過去 30 日間)
Sean McPeak
Sean McPeak 2022 年 7 月 30 日
回答済み: Sean McPeak 2022 年 8 月 1 日
I am generating multiple route plots using geoscatter. Each plot has its own color but I would like to label each of the plots as well. Below is the code I am using to generate the plots from various gpx files. I appreciate any suggestions for how this can be done.
fig = figure;
pos = fig.Position;
files = dir('cast*.gpx');
for i = 1:length(files)
filename = files(i).name;
route = gpxread(filename);
geoscatter(route.Latitude, route.Longitude, 50, "filled")
hold on
end

採用された回答

Chunru
Chunru 2022 年 7 月 30 日
fig = figure;
%pos = fig.Position;
%files = dir('cast*.gpx');
for i = 1:5 %length(files)
%filename = files(i).name;
%route = gpxread(filename);
route.Latitude = rand(10,1) + i;
route.Longitude = rand(10,1);
geoscatter(route.Latitude, route.Longitude, 50, "filled",'DisplayName', string(i))
hold on
end
legend

その他の回答 (1 件)

Sean McPeak
Sean McPeak 2022 年 8 月 1 日
Thank you that is very helpful and is working well.

カテゴリ

Help Center および File ExchangeGraphics Object Properties についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by