Line Plots

Line plots, log plots, and function plots

Line plots are a useful way to compare sets of data or track changes over time. You can plot the data in a 2-D or 3-D view using either a linear or a logarithmic scale. Also, you can plot expressions or functions over specific intervals.

Functions

expand all

plot2-D line plot
plot33-D point or line plot
stairsStairstep graph
errorbarLine plot with error bars
areaFilled area 2-D plot
stackedplotStacked plot of several variables with common x-axis
loglogLog-log scale plot
semilogxSemilog plot (x-axis has log scale)
semilogySemilog plot (y-axis has log scale)
fplotPlot expression or function
fimplicitPlot implicit function
fplot33-D parametric curve plotter

Properties

expand all

Line Plots

Line PropertiesChart line appearance and behavior
Stair PropertiesStair chart appearance and behavior
ErrorBar PropertiesError bar chart appearance and behavior
Area PropertiesArea chart appearance and behavior
StackedLineChart PropertiesStacked plot appearance and behavior
StackedAxesProperties PropertiesAppearance and behavior of individual axes in stacked plot
StackedLineProperties PropertiesAppearance and behavior of individual lines in stacked plot

Function Plots

FunctionLine PropertiesLine chart appearance and behavior
ImplicitFunctionLine PropertiesImplicit line chart appearance and behavior
ParameterizedFunctionLine PropertiesParameterized line chart appearance and behavior

MATLAB Language Syntax

Topics

Create 2-D Line Plot

Create a 2-D line plot and specify the line style, line color, and marker type.

Create Line Plot with Markers

Add markers to a line plot to distinguish multiple lines or to highlight particular data points.

Line Plot with Confidence Bounds

Create a plot with confidence bounds using the fill function to draw the confidence bounds and the plot function to draw the data points.

Plot Dates and Durations

This example shows how to create line and scatter plots of datetime and duration values using the plot function. It also shows how to customize the axes.

Create Chart with Two y-Axes

Create a chart with y-axes on both the left and right sides.

Combine Line and Bar Charts Using Two y-Axes

This example shows how to combine a line chart and a bar chart using two different y-axes.

Control Colors, Line Styles, and Markers in Plots

Control the colors, line styles, and markers used for plotting by setting properties on the axes and line objects.

Plot Imaginary and Complex Data

Plot the imaginary part versus the real part of a complex vector.

Compare Data Sets Using Overlayed Area Graphs

This example shows how to compare two data sets by overlaying their area graphs.