plot
Single line plot
x = -15:0.1:5 y = airy(x) plot(x, y)
Logarithmic scale
options.yAxisScale = 'Log' x = linspace(0,2) y = log(10.0.^x) plot(x, y, options)
Single vector input
x = 0:0.5:4*pi plot(round(cos(x)))
Matrix input
X = linspace(0,2*pi,50)' Y = [cos(X), 0.5*sin(X)] plot(Y, options)
Table input
x = 1:0.1:10 y1 = sin(x) y2 = cos(x) t = table(x', y1', y2', 'VariableNames', {'x', 'sin(x)', 'cos(x)'}) plot(t)
Dashed lines
options.dashArray = '1 2 4' y = magic(5) plot(y, options)
Overlaying curves
x = 0:0.05:8 y = [besselj(1,x) besselj(2, x) besselj(3, x) besselj(4, x) besselj(5, x)] plot(x, y, options)
Customizing colors
options = struct('colors', {'Gainsboro','Gray','GoldenRod'}) options.xAxisTicks = 5 options.yAxisTicks = 4 x = 0:pi/100:2*pi y1 = sin(x) y2 = sin(x-0.25) y3 = sin(x-0.5) plot(x,[y1;y2;y3]', options)
Filling area and adding markers
options = struct options.lineStroke = 'purple' options.lineWidth = 3 options.markerSize = 8 options.markerColor = 'brown' options.markerFill = 'orange' options.lineFill = 'lightsteelblue' x = linspace(-pi,pi,20) y = tan(sin(x)) - sin(tan(x)) plot(x, y, options)
Related documentation
Basic Options and Setup - GeneralBasic Options and Setup - Axes
Basic Options and Setup - Frame and Canvas
Basic Options and Setup - Lines, Markers, Areas and Bars
Basic Options and Setup - Legend
Basic Options and Setup - Labels
2D graphs - Line and Scatter Plots
2D graphs - Plotting Time Series
2D graphs - Secondary Axis
2D graphs - Formatting Axes