3-D point or line plot
plot3(
assigns specific line styles, markers, and colors to each X
1,Y
1,Z
1,LineSpec
1,...,X
n,Y
n,Z
n,LineSpec
n)XYZ
triplet.
You can specify LineSpec
for some triplets and omit it for others. For
example, plot3(X1,Y1,Z1,'o',X2,Y2,Z2)
specifies markers for the first
triplet but not the for the second triplet.
plot3(___,
specifies
Name,Value
)Line
properties using one or more name-value pair arguments. Specify
the properties after all other input arguments. For a list of properties, see Line Properties.
plot3(
displays the plot in
the target axes. Specify the axes as the first argument in any of the previous
syntaxes.ax
,___)
returns a
p
= plot3(___)Line
object or an array of Line
objects. Use
p
to modify properties of the plot after creating it. For a list of
properties, see Line Properties.
Use NaN
or Inf
to create breaks in the lines.
For example, this code plots a line with a break between z=2
and
z=4
.
plot3([1 2 3 4 5],[1 2 3 4 5],[1 2 NaN 4 5])
plot3
uses colors and line styles based on the ColorOrder
and LineStyleOrder
properties of
the axes. plot3
cycles through the colors with the first line style.
Then, it cycles through the colors again with each additional line style.
Starting in R2019b, you can change the colors and the line styles after plotting by
setting the ColorOrder
or LineStyleOrder
properties on the axes. You can also call the colororder
function to change the color order for all the axes in the figure.