scatter

Spiral

theta = linspace(0,1,200)
x = exp(theta) .* sin(10*theta)
y = exp(theta) .* cos(10*theta)
scatter(x, y)

Table input

x = 1:0.1:10
y1 = sin(x)
y2 = cos(x)
t = table(x', y1', y2', 'VariableNames', {'x', 'sin(x)', 'cos(x)'})
scatter(t)

Matrix input

x = rand(50, 5)
scatter(x, options)

Logarithmic scale

options.yAxisScale = 'Log'
x = -1:0.1:4
y = exp(0.5*x)
scatter(x, y, options)

Single line plot

options = struct
options.lineWidth = 3
options.lineStroke = 'gray'
options.markerSize = 0
x = linspace(0,10);
y1 = 200*exp(-0.05*x).*sin(x)
scatter(x, y1, options)

Specifying line and area colors

options = struct
options.lineWidth = 1
options.markerSize = 4
options.markerStroke = '#00354d'
options.markerFill = '#99ddff'
options.lineFill = '#e5f7ff'
theta = linspace(0,2*pi)
x = 5*cos(theta) + 8;
y = 5*sin(theta) + 2;
scatter(x, y, options)

Filling polygon area

options = struct
x = [1.58, 0.35, -1.75, 0.375, 0.85, 2.2, 3, 2, 1.58]
y = [-2.57, -1.1, 2.0, 2, 1.15, 3.2, 0.05, -0.5, -2.57]
options.lineWidth = 2
options.xAxisMin = -4
options.xAxisTicks = 8
options.markerSize = 5
options.lineFill = 'lightgreen'
options.markerFill = 'green'
scatter(x, y, options)

Basis interpolation

options = struct
options.lineWidth = 2
options.lineInterpolate = 'Basis'
options.xAxisMin = -4
options.xAxisTicks = 8
options.markerSize = 5
options.markerFill = 'green'
options.lineFill = 'pink'
x = [1.58, 0.35, -1.75, 0.375, 0.85, 2.2, 3, 2, 1.58]
y = [-2.57, -1.1, 2.0, 2, 1.15, 3.2, 0.05, -0.5, -2.57]
scatter(x, y, options)

Step interpolation

options = struct
options.yAxisMin = 0
options.lineWidth = 2
options.lineInterpolate = 'Step'
x = [0 4 5 6 7 8 9 10]
y = [0 5 10 20 12 8 5 0]
scatter(x, y, options)

Bubble chart

options = struct
options.markerSize = [20 13 15 22 4 20 35 7]
x = [0 4 5 6 7 8 9 10]
y = [0 5 10 20 12 8 5 0]
scatter(x, y, options)

Marker stroke scale

options = struct
options.markerSize = 9
options.markerStroke = [4 10 9 12 20 16 7 22]
x = [0 4 5 6 7 8 9 10]
y = [0 5 10 20 12 8 5 0]
scatter(x, y, options) 

Marker color scale

options = struct
options.markerSize = 9
options.markerFill = [4 10 9 12 20 16 7 22]
options.colorScale = {'#e6f7ff','#66ccff','#0099e6','#004466'}
x = [0 4 5 6 7 8 9 10]
y = [0 5 10 20 12 8 5 0]
scatter(x, y, options)

Size scale and color scale

options = struct
options.markerSize = [20 13 15 22 4 20 35 7] 
options.markerFill = [4 10 9 12 20 16 7 22]
options.colorScale = {'#e6f7ff','#66ccff','#0099e6','#004466'}
x = [0 4 5 6 7 8 9 10]
y = [0 5 10 20 12 8 5 0]
scatter(x, y, options)

See also

plot | plotyy | plot3