一、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])
…………'BackgroundColor',[.7 .9 .7] …………
…………
二、HorizontalAlignment / VerticalAlignment 文本对齐方式
HorizontalAlignment 的值有
VerticalAlignment的值有 top | cap | {middle} | baseline |
三、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
bf — Bold font
it — Italic font
sl — Oblique font (rarely available)
rm — Normal fontfontname{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),...
text('Interpreter','latex',...
text(-5,5,['fontsize{16}itblack {color{magenta}rmmagenta '...
'color[rgb]{0 .5 .5}bfteal color{red}slred} black again'])