Project text annotation on map axes
h = textm(...)
textm(lat,lon,string) projects the text in string onto the current map axes at the locations specified by the lat and lon. The units of lat and lon must match the 'angleunits' property of the map axes. If lat and lon contain multiple elements, textm places a text object at each location. In this case string may be a cell array of strings with the same number of elements as lat and lon. (For backward compatibility, string may also be a 2-D character array such that size(string,1) matches numel(lat)).
textm(lat,lon,z,string,PropertyName,PropertyValue,...) sets the text object properties. All properties supported by the MATLAB® text function are supported by textm.
The feature of textm that distinguishes it from the standard MATLAB text function is that the text object is projected appropriately. Type the following:
axesm sinusoid framem('FEdgeColor','red') textm(60,90,'hello')
figure; axesm miller framem('FEdgeColor','red') textm(60,90,'hello')
The string 'hello' is placed at the same geographic point, but it appears to have moved relative to the axes because of the different projections. If you change the projection using the setm function, the text moves as necessary. Use text to fix text objects in the axes independent of projection.
You may be working with scalar lat and lon data or vector lat and lon data. If you are in scalar mode and you enter a cell array of strings, you will get a text object with a multiline string. Also note that vertical slash characters, rather than producing multiline strings, will yield a single line string containing vertical slashes. On the other hand, if lat and lon are nonscalar, then the size of the cell array input must match their size exactly.