matlab 部分text关键字

一、ColorSpec  定义颜色,本身并非关键字

  RGB Value  Short Name  Long Name
  [1 1 0]      y      yellow
  [1 0 1]      m     magenta
  [0 1 1]      c      cyan
  [1 0 0]      r      red
  [0 1 0]      g      green
  [0 0 1]      b      blue
  [1 1 1]      w      white
  [0 0 0]      k      black

说明:使用RGB格式的话直接使用即可,使用ShortName/LongName还需要加' ',另外RGB格式除了整数值以外还可用浮点数,所以颜色更丰富。

eg:set(gcf,'Color',[1,1,0])  = set(gcf,'Color','y')

  …………'BackgroundColor',[.7 .9 .7] …………

  …………

 

二、HorizontalAlignment  /  VerticalAlignment  文本对齐方式

  HorizontalAlignment 的值有  'left','center','right'

  VerticalAlignment的值有  top | cap | {middle} | baseline |  bottom,加''用,{}表示默认

 

三、BackgroundColor  背景颜色,值参考(一)  需要命令二

 

四、 Edgecolor  边框颜色,值参考(一)

 

五、LineStyle  线形  需要命令四

  SymbolLine     Style
    -       Solid line (default) 实线
    --      Dashed line 虚线
    :       Dotted line 点线
    -.       Dash-dot line 虚点线
    none     No line 没线

 

六、LineWidth  线宽  大于0标量值,默认为1,不加引号用  需要命令四

 

七、Margin  边缘宽度  大于0标量值,默认貌似为1,不加引号用  需要命令二

 

八、Rotation  旋转角度  标量值,默认0,角度制,可以为负

 

九、Position  定位  默认定位左下角,但若设定了对齐方式则按照对齐方式,如果之前定位过,那么position后就变为position的,[x y (z)],z默认为0

 

十、string  与 Interpreter  latex | {tex} | none 的设定相关,当设定为前两个时,可以使用一系列的特殊字符,特点是用 \ 开头。

\bf — Bold font

\it — Italic font

\sl — Oblique font (rarely available)

\rm — Normal font\fontname{fontname} —Specify the name of the font family touse.

\fontsize{fontsize} —Specify the font size in FontUnits.

\color(colorSpec) —Specify color for succeeding characters

 

eg:

figure;axis([-10,10,-10,10]);
text(3*pi/10,sin(3*pi/10),...   %这里定义了一次位置,按照默认的左下角对齐
 ['sin(3*pi/4) = ',num2str(sin(3*pi/4))],...
 'HorizontalAlignment','left',...
    'VerticalAlignment','top',...   %这两条命令指定了左上角对齐(默认左下)
 'BackgroundColor',[0,1,1],...   %背景色
    'margin',1,...  %边缘宽,默认1
    'Edgecolor',[1 0 0],... 边框色,默认没有边框
    'Linewidth',2,...   %线宽,默认1
    'linestyle',':',... %线形,默认实线
    'rotation',0,...    %旋转角,默认0,角度制
    'position',[2 4]);  %又定义了一次位置,按照设定的左上角对齐

text('Interpreter','latex',...
 'String','$$\int_0^x\!\int_y dF(u,v)$$',... %string 和$必须要
 'Position',[-5 -5],...
 'FontSize',16)
  
text(-5,5,['\fontsize{16}\itblack {\color{magenta}\rmmagenta '...
'\color[rgb]{0 .5 .5}\bfteal \color{red}\slred} black again'])

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值