29 lines
700 B
Matlab
29 lines
700 B
Matlab
x = 1:2:100;
|
|
y = (0.5 .* x - 0.56) + randn(size(x)) .* 5.;
|
|
|
|
f = figure();
|
|
set(f, 'paperunits', 'centimeter', 'papersize', [15, 5], ...
|
|
'paperposition', [0, 0, 15, 5], 'color', 'white');
|
|
|
|
subplot(1, 3, 1);
|
|
scatter(x, y, 15, 'r', 'filled');
|
|
xlabel('x');
|
|
ylabel('y');
|
|
text(-35, max(ylim) * 1.075,'A', 'FontSize', 12);
|
|
|
|
subplot(1, 3, 2)
|
|
scatter(x, y, 1:length(x), 'r');
|
|
xlabel('x');
|
|
ylabel('y');
|
|
text(-35, max(ylim) * 1.075,'B', 'FontSize', 12);
|
|
|
|
subplot(1, 3, 3)
|
|
colors = zeros(length(x),3);
|
|
colors(:,1) = round(1:255/length(x):255)/255';
|
|
scatter(x, y, 15, colors, 'filled')
|
|
xlabel('x');
|
|
ylabel('y');
|
|
text(-35, max(ylim) * 1.075,'C', 'FontSize', 12);
|
|
|
|
saveas(f, '../lecture/images/scatterplot.png')
|