% dxdy.ru/topic151093.html
% 2022.10.23 B@R5uk
clc
clearvars
format compact
xl = 10;
yl = 6;
xm = 9;
ym = 4;
ya = 2.5;
bkgrColor = [1, 1, 1];
gridColor = [.7, .7, .7];
axisColor = [0, 0, 0];
lineColor = [0.8, 0.5, 0];
arrSize = 0.85;
arrWidth = 0.15;
x = (-xm : xm)';
y = ya * randn (size (x));
y = min (ym, max (-ym, y));
xx = (-xm : 0.01 : xm)';
yy = spline (x, y, xx);
plot (0, 0)
hold on
for k = -xl : xl
if 0 == k
continue
end
plot ([1; 1] * k, [-1; 1] * yl, 'Color', gridColor)
end
for k = -yl : yl
if 0 == k
continue
end
plot ([-1; 1] * xl, [1; 1] * k, 'Color', gridColor)
end
plot ([0; 0], [-1; 1] * yl, 'Color', axisColor, 'LineWidth', 2)
plot ([-1; 0; 1] * arrWidth, [1; 1; 1] * yl - [1; 0; 1] * arrSize, 'Color', axisColor, 'LineWidth', 2)
plot ([-1; 1] * xl, [0; 0], 'Color', axisColor, 'LineWidth', 2)
plot ([1; 1; 1] * xl - [1; 0; 1] * arrSize, [-1; 0; 1] * arrWidth, 'Color', axisColor, 'LineWidth', 2)
%plot (x, y, 'o')
plot (xx, yy, 'Color', lineColor, 'LineWidth', 2)
hold off
axis equal
axis off
xlim ([-1; 1] * xl)
ylim ([-1; 1] * yl)
set (gcf, 'Color', bkgrColor)
set (gca, 'FontName', 'Arial')
text (-arrWidth, 1, '1', 'FontName', 'Arial', 'FontSize', 14, 'HorizontalAlignment', 'right', 'VerticalAlignment', 'middle');
text (1, -arrWidth, '1', 'FontName', 'Arial', 'FontSize', 14, 'HorizontalAlignment', 'center', 'VerticalAlignment', 'top')
text (-2 * arrWidth, yl, '{\it Y}', 'FontName', 'Arial', 'FontSize', 14, 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top');
text (xl - arrWidth, -2 * arrWidth, '{\it X}', 'FontName', 'Arial', 'FontSize', 14, 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top')
text ( -arrWidth, -arrWidth, '{\it O}', 'FontName', 'Arial', 'FontSize', 14, 'HorizontalAlignment', 'right', 'VerticalAlignment', 'top')