matlab函数line

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

line

Create line object

Syntax

line

line(X,Y)

line(X,Y,Z)

line(X,Y,Z,'PropertyName',propertyvalue,...)

line('XData',x,'YData',y,'ZData',z,...)

h = line(...)

Properties

For a list of properties, see Line Properties.

Description

line creates a line object in the current axes with default values x = [0 1] and y = [0 1]. You can specify the color, width, line style, and marker type, as well as other characteristics.

The line function has two forms:

•Automatic color and line style cycling. When you specify multiple line coordinate data as a column array using the informal syntax

(i.e., the first three arguments are interpreted as the

coordinates),

line(X,Y,Z)

MATLAB cycles through the axes ColorOrder and LineStyleOrder

property values the way the plot function does. However, unlike plot, line does not call the newplot function.

•Purely low-level behavior. When you call line with only property name/property value pairs,

line('XData',x,'YData',y,'ZData',z)

MATLAB draws a line object in the current axes using the default line color (see the colordef function for information on color

defaults). Note that you cannot specify matrix coordinate data with the low-level form of the line function.

line(X,Y) adds the line defined in vectors X and Y to the current axes. If X and Y are matrices of the same size, line draws one line per column.

line(X,Y,Z) creates lines in three-dimensional coordinates.

line(X,Y,Z,'PropertyName',propertyvalue,...) creates a line using the values for the property name/property value pairs specified and default values for all other properties. For a description of the properties, see Line Properties.

See the LineStyle and Marker properties for a list of supported values.

line('XData',x,'YData',y,'ZData',z,...) creates a line in the current axes using the property values defined as arguments. This is the low-level form of the line function, which does not accept matrix coordinate data as the other informal forms described above.

h = line(...) returns a column vector of handles corresponding to each line object the function creates.

Tips

In its informal form, the line function interprets the first three arguments (two for 2-D) as the X, Y, and Z coordinate data, allowing you to omit the property names. You must specify all other properties as name/value pairs. For example,

line(X,Y,Z,'Color','r','LineWidth',4)

The low-level form of the line function can have arguments that are only property name/property value pairs. For example,

line('XData',x,'YData',y,'ZData',z,'Color','r','LineWidth',4)

Line properties control various aspects of the line object and are described in Line Properties. You can also set and query property values after creating the line using set and get.

相关文档
最新文档