text(x,y,'string')在图形中指定的位置(x,y)上显示字符串string.
text(x,y,z,’string’.'PropertyName',PropertyValue„)对引号中的文字string定位于用坐标轴指定的位置,且对指定的 属性进行设置。
例:>> x = –4:0.2:4;
>> y = sin(x);
>> hp = line(x,y,‘LineWidth’,3);
>> thand = text(2,0,‘Sin(pi)rightarrow’)
结果如图1所示:
对图中所加的标识符进行设置后
>>set(thand,‘BackgroundColor’,[0.8 0.8 0.8],. . .
‘EdgeColor’,[1 0 0])
结果如图2所示:
附加内容:
>> rh = rectangle(‘Position’, [0.2, 0.2, 0.5, 0.8],‘Curvature’,[0.5, 0.5]);