加载中…
个人资料
  • 博客等级:
  • 博客积分:
  • 博客访问:
  • 关注人气:
  • 获赠金笔:0支
  • 赠出金笔:0支
  • 荣誉徽章:
正文 字体大小:

[转载]matlab画图之text用法

(2017-06-04 18:03:20)
标签:

转载

分类: matlab研究
原文地址:matlab画图之text用法作者:5Geo
         text命令可以让我们在图上做标记,作出简单的说明,类似于图例的功能,但不止于图例。下面是matlab中的text命令的语法:
  1. text(x,y,'string')    在2D图形中指定的位置(x,y)上显示字符串string
  2. text(x,y,z,'string') 在3D图形中指定的位置(x,y,z)上显示字符串string
  3. text(x,y,z,'string','PropertyName',PropertyValue....)
  4. text('PropertyName',PropertyValue....)
  5. h = text(...)  
                ProperrtyName:属性名字,字符的一些修饰性的东西
                    
    以矩形边框为例
                        BackgroundColor —矩形边框的背景颜色 (none by default)
                        EdgeColor — 矩形边框的颜色 (none by default)
                        LineStyle — 矩形边框的线条形式(是虚线还是点线还是。。。。)(first set EdgeColor)
                        LineWidth — 矩形边框的宽度 (first set EdgeColor

                        Margin
    边沿           

                PropertyValue:  属性值

命令:
 plot(0:pi/20:2*pi,sin(0:pi/20:2*pi))
 text(3*pi/4,sin(3*pi/4),'leftarrowsin(t) = .707','EdgeColor','red');
Fig:



常用的颜色表示:
RGB    Short      Long
[1 1 0]             yellow
[1 0 1]            magenta  品红
[0 1 1]             cyan        青色
[1 0 0]    r            red
[0 1 0]             green
[0 0 1]             blue
[1 1 1]             white
[0 0 0]              black

whitebg([0 1 0]); whitebg('g'); whitebg('green');
note:如果使用上面的命令时,画布背景颜色可能你就不知道怎么调回来,使用 colordef white这个就可以恢复画布的默认的背景颜色了,或者妮使用whitebg('white')也能恢复。


 


0

  

新浪BLOG意见反馈留言板 欢迎批评指正

新浪简介 | About Sina | 广告服务 | 联系我们 | 招聘信息 | 网站律师 | SINA English | 产品答疑

新浪公司 版权所有