Documentation

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.

plot3

Syntax

plot3(X1,Y1,Z1,...)
plot3(X1,Y1,Z1,LineSpec,...)
plot3(...,'PropertyName',PropertyValue,...)
plot3(ax,...)
h = plot3(...)

Description

The plot3 function displays a three-dimensional plot of a set of data points.

plot3(X1,Y1,Z1,...), where X1, Y1, Z1 are vectors or matrices, plots one or more lines in three-dimensional space through the points whose coordinates are the elements of X1, Y1, and Z1. The values in X1, Y1, and Z1 can be numeric or datetime or duration values.

plot3(X1,Y1,Z1,LineSpec,...) creates and displays all lines defined by the Xn,Yn,Zn,LineSpec quads, where LineSpec is a line specification that determines line style, marker symbol, and color of the plotted lines.

plot3(...,'PropertyName',PropertyValue,...) sets line properties to the specified property values for all the charting lines created by plot3. See Chart Line Properties for a description of the properties you can set.

plot3(ax,...) creates the line in the axes specified by ax instead of in the current axes (gca). The option ax can precede any of the input argument combinations in the previous syntaxes.

h = plot3(...) returns a column vector of chart line objects.

Examples

collapse all

Define t as values between 0 and $10\pi$. Define st and ct as vectors of sine and cosine values. Plot a 3-D helix.

t = 0:pi/50:10*pi;
st = sin(t);
ct = cos(t);

figure
plot3(st,ct,t)

More About

collapse all

Tips

If one or more of X1, Y1, Z1 is a vector, the vectors are plotted versus the rows or columns of the matrix, depending whether the vectors' lengths equal the number of rows or the number of columns.

You can mix Xn,Yn,Zn triples with Xn,Yn,Zn,LineSpec quads, for example,

plot3(X1,Y1,Z1,X2,Y2,Z2,LineSpec,X3,Y3,Z3)

See LineSpec and plot for information on line types and markers.

See Also

Functions

Properties

Introduced before R2006a

Was this topic helpful?