This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


2D line segments

MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


plot::Line2d([x1, y1], [x2, y2], <a = amin .. amax>, options)


plot::Line2d([x1, y1], [x2, y2]) creates a 2D line segment between the points (x1, y1) and (x2, y2).

The end points can be passed as lists or vectors.


AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
AntiAliasedantialiased lines and points?TRUE
Colorthe main colorRGB::Blue
Extensionline extensionsFinite
Framesthe number of frames in an animation50
Fromstarting point of arrows and lines[0, 0]
FromXstarting point of arrows and lines, x-coordinate0
FromYstarting point of arrows and lines, y-coordinate0
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineStylesolid, dashed or dotted lines?Solid
Namethe name of a plot object (for browser and legend) 
ParameterEndend value of the animation parameter 
ParameterNamename of the animation parameter 
ParameterBegininitial value of the animation parameter 
ParameterRangerange of the animation parameter 
TimeEndend time of the animation10.0
TimeBeginstart time of the animation0.0
TimeRangethe real time span of an animation0.0 .. 10.0
Titleobject title 
TitleFontfont of object titles[" sans-serif ", 11]
TitlePositionposition of object titles 
TitleAlignmenthorizontal alignment of titles w.r.t. their coordinatesCenter
TitlePositionXposition of object titles, x component 
TitlePositionYposition of object titles, y component 
Toend point of arrows and lines[1, 0]
ToXend point of arrows and lines, x-coordinate1
ToYend point of arrows and lines, y-coordinate0
VisibleAfterobject visible after this time value 
VisibleBeforeobject visible until this time value 
VisibleFromToobject visible during this time range 
VisibleAfterEndobject visible after its animation time ended?TRUE
VisibleBeforeBeginobject visible before its animation time starts?TRUE


Example 1

Create a 2D line segement:

plot(plot::Line2d([1, 2], [3,-1]))

Change the LineStyle from the default Solid value to Dashed or Dotted. Also, set LineColor and LineWidth explicitly:

plot(plot::Line2d([1, 2], [3, -1], 
                  LineStyle = Dashed, 
                  LineWidth = 2.5*unit::mm, 
                  LineColor = RGB::Green))


x1, y1

Coordinates of one end point: real numerical values or arithmetical expressions of the animation parameter a.

x1, y1 are equivalent to the attributes FromX, FromY.

x2, y2

Coordinates of the other end point: real numerical values or arithmetical expressions of the animation parameter a.

x2, y2, z2 are equivalent to the attributes ToX, ToY, ToZ.


Animation parameter, specified as a = amin..amax, where amin is the initial parameter value, and amax is the final parameter value.

See Also

MuPAD Functions

MuPAD Graphical Primitives

Was this topic helpful?