matlab arrow3函数,arrow3.m · octopus/spatialmath-matlab - Gitee.com

该函数用于在MATLAB中绘制从P1到P2带有箭头的线条,支持多种颜色、线型和宽度设置。文章详细解释了函数参数及用法,并提供了示例代码。
摘要由CSDN通过智能技术生成

function hn=arrow3(p1,p2,s,w,h,ip,alpha,beta)

% ARROW3 (R13)

% ARROW3(P1,P2) draws lines from P1 to P2 with directional arrowheads.

% P1 and P2 are either nx2 or nx3 matrices. Each row of P1 is an

% initial point, and each row of P2 is a terminal point.

%

% ARROW3(P1,P2,S,W,H,IP,ALPHA,BETA) can be used to specify properties

% of the line, initial point marker, and arrowhead. S is a character

% string made with one element from any or all of the following 3

% columns:

%

% Color Switches LineStyle LineWidth

% ------------------ ------------------- --------------------

% k blacK (default) - solid (default) 0.5 points (default)

% y Yellow : dotted 0 no lines

% m Magenta -. dashdot / LineWidthOrder

% c Cyan -- dashed

% r Red * LineStyleOrder _______ __

% g Green ^ |

% b Blue / \ |

% w White Arrowhead / \ Height

% a Asparagus / \ |

% d Dark gray / \ |

% e Evergreen /___ ___\ __|__

% f Firebrick | | | |

% h Hot pink |-- Width --|

% i Indigo | | | |

% j Jade | |

% l Light gray | |

% n Nutbrown | |

% p Pear | |

% q kumQuat Line -->| |

% s Sky blue | |

% t Tawny | |

% u bUrgundy | |

% v Violet | |

% z aZure | |

% x random Initial / \

% o colorOrder Point -->( )

% | magnitude Marker \_ _/

%

% -------------------------------------------------------------

% Color Equivalencies

% -------------------------------------------------------------

% ColorOrder Arrow3 | Simulink Arrow3

% ---------- ---------- | ---------- ----------

% Color1 Blue | LightBlue aZure

% Color2 Evergreen | DarkGreen Asparagus

% Color3 Red | Orange kumQuat

% Color4 Sky blue | Gray Light gray

% Color5 Violet |

% Color6 Pear |

% Color7 Dark gray |

% -------------------------------------------------------------

%

% The components of S may be specified in any order. Invalid

% characters in S will be ignored and replaced by default settings.

%

% Prefixing the color code with '_' produces a darker shade, e.g.

% '_t' is dark tawny; prefixing the color code with '^' produces a

% lighter shade, e.g. '^q' is light kumquat. The relative brightness

% of light and dark color shades is controlled by the scalar parameter

% BETA. Color code prefixes do not affect black (k), white (w), or

% the special color switches (xo|).

%

% ColorOrder may be achieved in two fashions: The user may either

% set the ColorOrder property (using RGB triples) or define the

% global variable ColorOrder (using a string of valid color codes).

% If the color switch is specified with 'o', and the global variable

% ColorOrder is a string of color codes (color switches less 'xo|',

% optionally prefixed with '_' or '^'), then the ColorOrder property

% will be set to the sequence of colors indicated by the ColorOrder

% variable. The color sequence 'bersvpd' matches the default

% ColorOrder property. If the color switch is specified with 'o', and

% the global variable ColorOrder is empty or invalid, then the current

% ColorOrder property will be used. Note that the ColorOrder variable

% takes precedence over the ColorOrder property.

%

% The magnitude color switch is used to visualize vector magnitudes

% in conjunction with a colorbar. If the color switch is specified

% with '|', colors are linearly interpolated from the current ColorMap

% according to the length of the associated line. This option sets

% CLim to [MinM,MaxM], where MinM and MaxM are the minimum and maximum

% magnitudes, respectively.

%

% The current LineStyleOrder property will be used if LineStyle is

% specified with '*'. MATLAB cycles through the line styles defined

% by the LineStyleOrder property only after using all colors defined

% by the ColorOrder property. If however, the global variable

% LineWidthOrder is defined, and LineWidth is specified with '/',

% then each line will be drawn with sequential color, linestyle, and

% linewidth.

%

% W (default = 1) is a vector of arrowhead widths; use W = 0 for no

% arrowheads. H (default = 3W) is a vector of arrowhead heights. If

% vector IP is neither empty nor negative, initial point markers will

% be plotted with diameter IP; for default diameter W, use IP = 0.

% The units of W, H and IP are 1/72 of the PlotBox diagonal.

%

% ALPHA (default = 1) is a vector of FaceAlpha values ranging between

% 0 (clear) and 1 (opaque). FaceAlpha is a surface (arrowhead and

% initial point marker) property and does not affect lines. FaceAlpha

% is not supported for 2D rendering.

%

% BETA (default = 0.4) is a scalar that controls the relative

% brightness of light and dark color shades, ranging between 0 (no

% contrast) and 1 (maximum contrast).

%

% Plotting lines with a single color, linestyle, and linewidth is

% faster than plotting lines with multiple colors and/or linestyles.

% Plotting lines with multiple linewidths is slower still. ARROW3

% chooses renderers that produce the best screen images; exported

% or printed plots may benefit from different choices.

%

% ARROW3(P1,P2,S,W,H,'cone',...) will plot cones with bases centered

% on P1 in the direction given by P2. In this instance, P2 is

% interpreted as a direction vector instead of a terminal point.

% Neither initial point markers nor lines are plotted with the 'cone'

% option.

%

% HN = ARROW3(P1,P2,...) returns a vector of handles to line and

% surface objects created by ARROW3.

%

% ARROW3 COLORS will plot a table of named colors with default

% brightness. ARROW3('colors',BETA) will plot a table of named

% colors with brightness BETA.

%

% ARROW3 attempts to preserve the appearance of existing axes. In

% particular, ARROW3 will not change XYZLim, View, or CameraViewAngle.

% ARROW3 does not, however, support stretch-to-fill scaling. AXIS

% NORMAL will restore the current axis box to full size and remove any

% restrictions on the scaling of units, but will likely result in

% distorted arrowheads and initial point markers. See

% (arrow3_messes_up_my_plots.html).

%

% If a particular aspect ratio or variable limit is required, use

% DASPECT, PBASPECT, AXIS, or XYZLIM commands before calling ARROW3.

% Changing limits or aspect ratios after calling ARROW3 may alter the

% appearance of arrowheads and initial point markers. ARROW3 sets

% XYZCLimMode to manual for all plots, sets DataAspectRatioMode to

% manual for linear plots, and sets PlotBoxAspectRatioMode to manual

% for log plots and 3D plots. CameraViewAngleMode is also set to

% manual for 3D plots.

%

% ARROW3 UPDATE will restore the appearance of arrowheads and

% initial point markers that have become corrupted by changes to

% limits or aspect ratios. ARROW3('update',SF) will redraw initial

% point markers and arrowheads with scale factor SF. If SF has one

% element, SF scales W, H and IP. If SF h

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值