Project text annotation on map axes
textm(lat,lon,string)
textm(lat,lon,z,string)
textm(lat,lon,z,string
,PropertyName
,PropertyValue,...)
h = textm(...)
textm(lat,lon,string)
projects the text instring
onto the current map axes at the locations specified by thelat
andlon
. The units oflat
andlon
must match the'angleunits'
property of the map axes. Iflat
andlon
contain multiple elements,textm
places a text object at each location. In this casestring
可能是一个单元阵列的特征向量same number of elements aslat
andlon
. (For backward compatibility,string
may also be a 2-D character array such that size(string,1)
matchesnumel(lat)
).
textm(lat,lon,z,string)
draws the text at the altitude(s) specified inz
, which must be the same size aslat
andlon
. The default altitude is 0.
textm(lat,lon,z,
sets the text object properties. All properties supported by the MATLAB®string
,PropertyName
,PropertyValue,...)text
function are supported bytextm
.
h = textm(...)
returns the handles to the text objects drawn.
The feature oftextm
that distinguishes it from the standard MATLABtext
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 text'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 thesetm
function, the text moves as necessary. Usetext
to fix text objects in the axes independent of projection.
You may be working with scalarlat
andlon
data or vectorlat
andlon
data. If you are in scalar mode and you enter a cell array of character vectors, you will get a text object containing multiple lines. Also note that vertical slash characters, rather than producing multiple lines of text, yield a single line of text containing vertical slashes. On the other hand, iflat
andlon
are nonscalar, then the size of the cell array input must match their size exactly.