How can I label multiple routes on a geoscatter plot?

3 visualizaciones (últimos 30 días)
Sean McPeak
Sean McPeak el 30 de Jul. de 2022
Respondida: Sean McPeak el 1 de Ag. de 2022
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

Respuesta aceptada

Chunru
Chunru el 30 de Jul. de 2022
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

Más respuestas (1)

Sean McPeak
Sean McPeak el 1 de Ag. de 2022
Thank you that is very helpful and is working well.

Categorías

Más información sobre Graphics Object Properties en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by