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.


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::Polygon3d([pt3d1, pt3d2, …], <a = amin .. amax>, options)
plot::Polygon3d(M3d, <a = amin .. amax>, options)


plot::Polygon3d defines polygons in 3D by a given list of vertex points. A polygon consists of points and edges. The edges are made up of the lines traversing from the first to the second point, the second to the third point, and so on. The last point is automatically connected with the first point if the attribute Closed = TRUE is specified.

Points and lines can be hidden via PointsVisible = FALSE and LinesVisible = FALSE. By default, the vertex points are hidden, and the edges are visible.

All points as a whole can be manipulated via PointStyle and PointSize. The attribute LineColor sets the color for all points and all lines. Likewise all lines can be manipulated via LineStyle and LineWidth.

You can vary the color of all lines and points via LineColorType. The default value is Flat. Specifying the values Dichromatic or Rainbow lets you set the second color LineColor2. With Functional, the colors are taken from a custom LineColorFunction. See Example 2.

A 3D polygon can only be filled if it is defined by three vertices (a triangle). The attribute Filled = TRUE is ignored for other 3D polygons.


AttributePurposeDefault Value
AffectViewingBoxinfluence of objects on the ViewingBox of a sceneTRUE
Closedopen or closed polygonsFALSE
Colorthe main colorRGB::Blue
Filledfilled or transparent areas and surfacesFALSE
FillColorcolor of areas and surfacesRGB::LightBlue
Framesthe number of frames in an animation50
Legendmakes a legend entry 
LegendTextshort explanatory text for legend 
LegendEntryadd this object to the legend?FALSE
LineColorcolor of linesRGB::Blue
LineWidthwidth of lines0.35
LineColor2color of linesRGB::DeepPink
LineStylesolid, dashed or dotted lines?Solid
LinesVisiblevisibility of linesTRUE
LineColorTypeline coloring typesFlat
LineColorFunctionfunctional line coloring 
LineColorDirectionthe direction of color transitions on lines[0, 0, 1]
LineColorDirectionXx-component of the direction of color transitions on lines0
LineColorDirectionYy-component of the direction of color transitions on lines0
LineColorDirectionZz-component of the direction of color transitions on lines1
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 
Points3dlist of 3D points 
PointSizethe size of points1.5
PointStylethe presentation style of pointsFilledCircles
PointsVisiblevisibility of mesh pointsFALSE
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 
TitlePositionZposition of object titles, z component 
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 2

Plot a closed star-shaped 3D polygon with various color attributes:

p := plot::Polygon3d(
       [([cos(PI*k/3), sin(PI*k/3), sin(PI*k/3)],
         [cos(PI*k/3 + PI/6)/2, 
          sin(PI*k/3 + PI/6)/2,
          sin(PI*k/3 + PI/6)/2]) $k = 1..6
       ], Closed = TRUE):
S1 := plot::Scene3d(p, LineColorType = Flat):
S2 := plot::Scene3d(p, LineColorType = Dichromatic):
S3 := plot::Scene3d(p, LineColorType = Dichromatic,
                    LineColor = RGB::Blue,
                    LineColor2 = RGB::Green):
S4 := plot::Scene3d(p, LineColorType = Rainbow,
                    LineColor = RGB::Blue,
                    LineColor2 = RGB::Green):
plot(S1, S2, S3, S4)

Plot the same polygon while animating its line color using a color function. The result is a dazzling star:

p := plot::Polygon3d(
       [([cos(PI*k/3), sin(PI*k/3), sin(PI*k/3)],
         [cos(PI*k/3 + PI/6)/2, 
          sin(PI*k/3 + PI/6)/2,
          sin(PI*k/3 + PI/6)/2]) $k = 1..6
       ], Closed = TRUE, 
       LineColorFunction = 
           proc(x, y, z, i, a) begin
             [sin(x + a*i)^2, sin(y + a*i)^2, sin(z + a*i)^2]:
       a = 0..10):

delete p, S1, S2, S3, S4


pt3d1, pt3d2, …

The 3D vertices. These must not be of type plot::Point3d, but lists of three numerical real values or arithmetical expressions of the animation parameter a (the coordinates).

pt3d1, pt3d2, … is equivalent to the attribute Points3d.


An array or a matrix with 3 columns. Each row provides the coordinates of one point.

M3d is equivalent to the attribute Points3d.


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?