Main Content

本页翻译不是最新的。点击此处可查看最新英文版本。

feather

创建以 x 轴为起点的箭头

  • Arrows along the x-axis

说明

示例

feather(U,V) 绘制以 x 轴为起点的箭头。使用笛卡尔分量 UV 指定箭头方向,其中 U 表示 x 分量,V 表示 y 分量。第 n 个箭头的起始点位于 x 轴上的 n。箭头的数量与 UV 中的元素数相匹配。

示例

feather(Z) 使用 Z 指定的复数值绘制箭头,实部表示 x 分量,虚部表示 y 分量。此语法等效于 feather(real(Z),imag(Z))

示例

feather(___,LineSpec) 设置箭头的线型、标记符号和颜色。

示例

feather(ax,___) 在指定坐标区(而不是当前坐标区)中绘制箭头。

示例

f = feather(___) 返回由包含 length(U)+1 个元素的 Line 对象组成的向量。前 length(U) 个元素表示各个箭头,最后一个元素表示沿 x 轴的水平线。创建绘图后,使用这些 Line 对象来控制绘图的外观。

示例

全部折叠

通过将每个箭头的分量指定为笛卡尔值来创建羽状图。第 n 个箭头以 x 轴上的 n 为起点。

t = -pi/2:pi/8:pi/2;
u = 10*sin(t);
v = 10*cos(t);
feather(u,v)

Figure contains an axes object. The axes object contains 10 objects of type line.

通过首先将极坐标转换为笛卡尔坐标,使用极坐标创建羽状图。

要完成此操作,请先用极坐标创建向量。使用 pol2cart 函数将它们转换为笛卡尔坐标。然后,创建绘图。

th = -pi/2:pi/16:0;
r = 10*ones(size(th));
[u,v] = pol2cart(th,r);
feather(u,v)

Figure contains an axes object. The axes object contains 10 objects of type line.

创建一个复数值向量。然后,使用羽状图显示这些复数值。实部确定每个箭头的 x 分量,虚部确定 y 分量。

Z = [2+3i -1-3i -1+i 2i 3-4i -2-2i -2+4i 0.5-i -3i 1+i];
feather(Z)

Figure contains an axes object. The axes object contains 11 objects of type line.

创建一个具有红色箭头的羽状图。

t = -pi/2:pi/8:pi/2;
u = 10*sin(t);
v = 10*cos(t);
feather(u,v,'r')

Figure contains an axes object. The axes object contains 10 objects of type line.

通过为单个箭头赋予变量,然后设置其属性来指定该箭头的线宽和颜色。要完成此操作,请先创建一个羽状图并返回一个 Line 对象数组。

t = -pi/2:pi/8:pi/2;
u = 10*sin(t);
v = 10*cos(t);
f = feather(u,v);

为第一个箭头赋予一个变量。第一个箭头对应于 uv 的第一组元素。然后,更改线宽和颜色。

f1 = f(1);
f1.Color = 'r';
f1.LineWidth = 2;

Figure contains an axes object. The axes object contains 10 objects of type line.

从 R2019b 开始,您可以使用 tiledlayoutnexttile 函数显示分块图。调用 tiledlayout 函数以创建 1×2 分块图布局。调用 nexttile 函数创建一个坐标区对象,并将该对象返回为 ax1。通过将 ax1 传递给 feather 函数来创建左图。通过将坐标区传递给 title 函数为绘图添加标题。重复上述过程以创建右图。

tiledlayout(1,2)

% Left plot
ax1 = nexttile;
t = 0:pi/8:pi/2;
u1 = 10*sin(t);
v1 = 10*cos(t);
feather(ax1,u1,v1)
title(ax1,'Left Plot')

% Right plot
ax2 = nexttile;
u2 = zeros(5,1);
v2 = [1 -2 3 -4 5];
feather(ax2,u2,v2)
title(ax2,'Right Plot')

Figure contains 2 axes objects. Axes object 1 with title Left Plot contains 6 objects of type line. Axes object 2 with title Right Plot contains 6 objects of type line.

输入参数

全部折叠

x 分量,指定为标量、向量或矩阵。指定笛卡尔值。要将数据从极坐标转换为笛卡尔坐标,请使用 pol2cart

U 的大小必须与 V 的大小匹配。

y 分量,指定为标量、向量或矩阵。指定笛卡尔值。要将数据从极坐标转换为笛卡尔坐标,请使用 pol2cart

V 的大小必须与 U 的大小匹配。

复数值,指定为标量、向量或矩阵。Z 的实部表示箭头的 x 分量,虚部表示 y 分量。

线型、标记和颜色,指定为包含符号的字符串标量或字符向量。符号可以按任意顺序显示。您不需要同时指定所有三个特征(线型、标记和颜色)。例如,如果忽略线型,只指定标记,则绘图只显示标记,不显示线条。

示例: "--or" 是带有圆形标记的红色虚线。

线型描述表示的线条
"-"实线

Sample of solid line

"--"虚线

Sample of dashed line

":"点线

Sample of dotted line

"-."点划线

Sample of dash-dotted line, with alternating dashes and dots

标记描述生成的标记
"o"圆圈

Sample of circle marker

"+"加号

Sample of plus sign marker

"*"星号

Sample of asterisk marker

"."

Sample of point marker

"x"叉号

Sample of cross marker

"_"水平线条

Sample of horizontal line marker

"|"垂直线条

Sample of vertical line marker

"square"方形

Sample of square marker

"diamond"菱形

Sample of diamond marker

"^"上三角

Sample of upward-pointing triangle marker

"v"下三角

Sample of downward-pointing triangle marker

">"右三角

Sample of right-pointing triangle marker

"<"左三角

Sample of left-pointing triangle marker

"pentagram"五角形

Sample of pentagram marker

"hexagram"六角形

Sample of hexagram marker

颜色名称短名称RGB 三元组外观
"red""r"[1 0 0]

Sample of the color red

"green""g"[0 1 0]

Sample of the color green

"blue""b"[0 0 1]

Sample of the color blue

"cyan" "c"[0 1 1]

Sample of the color cyan

"magenta""m"[1 0 1]

Sample of the color magenta

"yellow""y"[1 1 0]

Sample of the color yellow

"black""k"[0 0 0]

Sample of the color black

"white""w"[1 1 1]

Sample of the color white

目标坐标区,指定为 Axes 对象。

扩展功能

版本历史记录

在 R2006a 之前推出

另请参阅

函数

属性