arranged by Cristianozy
Linespec
- Line style, marker and color
Example: '--or'
is a red dashed line with circle markers
Line Style 线型
Line Style | Description | Resulting Line |
---|---|---|
'-' | Solid line | |
'--' | Dashed line | |
':' | Dotted line | |
'-.' | Dash-dotted line | |
LineWidth 线宽
线宽,是以磅为单位的正值,其中 1 磅 = 1/72 英寸。如果线条具有marker,则线条宽度也会影响marker的边缘。
线宽不能比1个像素的宽度细。如果将线宽设置为小于系统上像素宽度的值,则该线将显示为一个像素宽。
Marker 标记
Marker | Description | Resulting Marker |
---|---|---|
'o' | Circle | |
'+' | Plus sign | |
'*' | Asterisk | |
'.' | Point | |
'x' | Cross | |
'_' | Horizontal line | |
'|' | Vertical line | |
's' | Square | |
'd' | Diamond | |
'^' | Upward-pointing triangle | |
'v' | Downward-pointing triangle | |
'>' | Right-pointing triangle | |
'<' | Left-pointing triangle | |
'p' | Pentagram | |
'h' | Hexagram | |
-
MarkerIndices
显示标记的数据点索引用于显示标记的数据点的索引,指定为正整数的向量。 如果未指定索引,则 MATLAB 将在每个数据点显示一个标记。
-
Example:
plot(x,y,'-o','MarkerIndices',[1 5 10])
displays a circle marker at the first, fifth, and tenth data points.
-
Example:
plot(x,y,'-x','MarkerIndices',1:3:length(y))
displays a cross marker every three data points.
-
Example:
plot(x,y,'Marker','square','MarkerIndices',5)
displays one square marker at the fifth data point.
-
-
MarkerEdgeColor
标记的轮廓颜色MarkerEdgeColor,指定为“auto”、RGB 三元组、十六进制颜色代码、颜色名称或短名称。默认值“auto”使用与线条颜色属性相同的颜色。
-
MarkerFaceColor
标记填充颜色MarkerFaceColor,指定为“auto”、RGB 三元组、十六进制颜色代码、颜色名称或短名称。“auto”选项使用的颜色与父轴的 Color 属性的颜色相同。如果指定“auto”并且轴绘图框不可见,则标记填充颜色是figure的颜色。
-
MarkerSize
标记大小标记大小,指定为以磅为单位的正值,其中 1 磅 = 1/72 英寸。默认大小为6磅。
※ 颜色设定的细节如下。
Color 线条颜色
Color Name | Short Name | RGB Triplet | Appearance |
---|---|---|---|
'red' | 'r' | [1 0 0] | |
'green' | 'g' | [0 1 0] | |
'blue' | 'b' | [0 0 1] | |
'cyan' | 'c' | [0 1 1] | |
'magenta' | 'm' | [1 0 1] | |
'yellow' | 'y' | [1 1 0] | |
'black' | 'k' | [0 0 0] | |
'white' | 'w' | [1 1 1] | |
线条颜色,指定为 RGB 三元组、十六进制颜色代码、颜色名称或短名称。对于自定义颜色,请指定 RGB 三元组或十六进制颜色代码。
-
RGB 三元组是一个三元素行向量,其元素指定颜色的红色、绿色和蓝色分量的强度。强度必须在[0,1]范围内;例如,[0.4 0.6 0.7]。
plot(1:10, 'Color',[1 0 0]) %此处的RGB范围为0~1
-
十六进制颜色代码是以哈希符号 (#) 开头的字符向量或字符串标量,后跟三个或六个十六进制数字,其范围可以从 0 到 F。这些值不区分大小写。因此,颜色代码“#FF8800”、“#ff8800”、“#F80”和“#f80”是等效的。
plot(1:10, 'Color','#FF8800')
-
以下是 MATLAB 在许多类型的绘图中使用的默认颜色的 RGB 三元组和十六进制颜色代码。