How to plot text in mapshow map

I have this map I made using mapshow function:
map
I used the data in this structure to create the map:
structure.PNG
My function is (I need to plot each citie with specific color):
load mapnew.mat % the structure with data
load resultscorrigido.mat % just for colors of cities
[C,ia,ic] = unique(results(:,1));
palett = flipud(hsv(numel(C))); % parula, jet, hsv
for ii = 1:numel(Snew)
color = palett(ic(ii),:);
mapshow(Snew(results(ii,2)),'FaceColor',color);
end
I want to plot the names of the cities (Snew(:).NAME) using each LAT x LON coordinates. I tried the function textm, but I get an error:
textm(Snew(94).LAT,Snew(94).LON,Snew(94).NAME)
Error using gcm (line 25)
Not a map axes.
Error in textm (line 96)
mstruct = gcm;
How can I put a code inside my for loop to plot each citie name in my map?
Thanks in advance!

3 Kommentare

Katie
Katie am 24 Okt. 2019
Hi! Instead of textm(), try text(). Mapshow displays a map without projection so you don't have any mapping axes and therefore don't need the "m" suffix on your plot commands.
David Franco
David Franco am 25 Okt. 2019
Thank you very much Katie! It worked! Soooo simple...

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte

Gefragt:

am 13 Sep. 2019

Kommentiert:

am 15 Sep. 2022

Community Treasure Hunt

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

Start Hunting!

Translated by