plot - 2-D line plot
This MATLAB function creates a 2-D line plot of the data in Y versus the
corresponding values in X.
Vector and Matrix Data
plot(X,Y)
plot(X,Y,LineSpec)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
plot(Y)
plot(Y,LineSpec)
Table Data
plot(tbl,xvar,yvar)
plot(tbl,yvar)
Additional Options
plot(ax,___)
plot(___,Name,Value)
p = plot(___)
Input Arguments
X - x-coordinates
scalar | vector | matrix
Y - y-coordinates
scalar | vector | matrix
LineSpec - Line style, marker, and color
string scalar | character vector
tbl - Source table
table | timetable
xvar - Table variables containing x-coordinates
string array | character vector | cell array | pattern |
numeric scalar or vector | logical vector | vartype()
yvar - Table variables containing y-coordinates
string array | character vector | cell array | pattern |
numeric scalar or vector | logical vector | vartype()
ax - Target axes
Axes object | PolarAxes object | GeographicAxes object
Name-Value Arguments
Color - Line color
[0 0.4470 0.7410] (default) | RGB triplet | hexadecimal color code |
"r" | "g" | "b" | ...
LineStyle - Line style
"-" (default) | "--" | ":" | "-." | "none"
LineWidth - Line width
0.5 (default) | positive value
Marker - Marker symbol
"none" (default) | "o" | "+" | "*" | "." | ...
MarkerIndices - Indices of data points at which to display markers
1:length(YData) (default) | vector of positive integers |
scalar positive integer
MarkerEdgeColor - Marker outline color
"auto" (default) | RGB triplet | hexadecimal color code | "r" |
"g" | "b" | ...
MarkerFaceColor - Marker fill color
"none" (default) | "auto" | RGB triplet | hexadecimal color code |
"r" | "g" | "b" | ...
MarkerSize - Marker size
6 (default) | positive value
DatetimeTickFormat - Format for datetime tick labels
character vector | string
DurationTickFormat - Format for duration tick labels
character vector | string
Examples
openExample('graphics/CreateLinePlotExample')
openExample('graphics/PlotMultipleLinesExample')
openExample('graphics/CreateLinePlotFromMatrixExample')
openExample('graphics/SpecifyLineStyleExample')
openExample('graphics/SpecifyLineStyleColorAndMarkerExample')
openExample('graphics/DisplayMarkersAtSpecificDataPointsExample')
openExample('graphics/SpecifyLineWidthMarkerSizeAndMarkerColorExample')
openExample('graphics/AddTitleAndAxisLabelsExample')
openExample('matlab/SpecifyDurationTickFormatsExample')
openExample('graphics/PlotTableDataExample')
openExample('graphics/PlotTableMutliVariablesExample')
openExample('graphics/PlotSpecifyAxes19bExample')
openExample('graphics2/ChangeLinePropertiesUsingHandlesExample')
openExample('graphics/PlotCircleExample')
See also title, xlabel, ylabel, xlim, ylim, legend, hold, gca, yyaxis,
plot3, loglog, Line Properties
Introduced in MATLAB before R2006a
Documentation for plot
doc plot
Other uses of plot
AggregateBayesianOptimization/plot
alphaShape/plot
antenna.Circle/plot
backscatterBicyclist/plot
backscatterPedestrian/plot
Battery.Parameters/plot
Battery.Pulse/plot
Battery.PulseSequence/plot
BayesianOptimization/plot
blm/plot
cfit/plot
cgdatasetnode/plot
cgrules/plot
cgv.CGV/plot
clusterDBSCAN/plot
clustergram/plot
clustering.evaluation.CalinskiHarabaszEvaluation/plot
comm.MemorylessNonlinearity/plot
comm.Ray/plot
conjugateblm/plot
cornerPoints/plot
customblm/plot
cylinderModel/plot
DataMatrix/plot
diffuseblm/plot
digraph/plot
driving.heremaps.LaneTopology/plot
driving.Path/plot
drivingScenario/plot
dtree/plot
empiricalblm/plot
esbacktest/plot
eyeMask/plot
fairnessMetrics/plot
frd/plot
graph/plot
HeatMap/plot
iddata/plot
idnlarx/plot
idnlhw/plot
imageviewset/plot
InflationCollisionChecker/plot
KAZEPoints/plot
laneBoundarySegment/plot
lassoblm/plot
LayerGraph/plot
LeastSquaresResults/plot
lidarScan/plot
lime/plot
LinearModel/plot
localavfit/plot
localmod/plot
localmulti/plot
matlab.buildtool.Plan/plot
mixconjugateblm/plot
mixsemiconjugateblm/plot
monovslam/plot
mpc/plot
MSERRegions/plot
NLMEResults/plot
ntree/plot
opc.hda.Data/plot
opticalFlow/plot
parkingSpace/plot
pathPlannerRRT/plot
pcviewset/plot
phased.FMCWWaveform/plot
phased.LinearFMWaveform/plot
phased.MFSKWaveform/plot
phased.PhaseCodedWaveform/plot
phased.RectangularWaveform/plot
phased.SteppedFMWaveform/plot
phytree/plot
polyshape/plot
predmaint/plot
prob.NormalDistribution/plot
propagationData/plot
pulseWaveformLibrary/plot
reidentificationmetrics/plot
RepeatedMeasuresModel/plot
rfchain/plot
rgbdvslam/plot
roadrunnerHDMap/plot
rocmetrics/plot
semiconjugateblm/plot
sfit/plot
shapley/plot
SimBiology.fit.ParameterConfidenceInterval/plot
SimBiology.fit.PredictionConfidenceInterval/plot
SimBiology.gsa.ElementaryEffects/plot
SimBiology.gsa.MPGSA/plot
SimBiology.gsa.Sobol/plot
simscape.logging.Node/plot
simscape.logging.Series/plot
simscape.logging/plot
Simulink.sdi.DatasetRef/plot
Simulink.sdi/plot
Simulink.SimulationData.Parameter/plot
slrealtime.ProfilerData/plot
stereovslam/plot
sweepset/plot
tall/plot
timeseries/plot
tireData/plot
tireModel/plot
trajectoryErrorMetrics/plot
umargin/plot
varbacktest/plot
vehicleCostmap/plot
wdectree/plot
xregmodel/plot
xregtransient/plot
xregtwostage/plot