Hi Joris,
As per my understanding, you are trying to add in-line labels to line plots.
You can use the "text" function to add in-line labels to line plots.
Refer to the following documentation for more information on the "text" function:
Refer to the following sample code with a simple contour and line plot with inline labels:
% Contour plot data
[X, Y] = meshgrid(-3:0.1:3, -3:0.1:3);
Z = X.^2 + Y.^2;
% Create the contour plot
figure;
[C, h] = contour(X, Y, Z, 8, 'LineWidth', 1);
clabel(C, h, 'FontSize', 8, 'Color', 'k');
hold on;
% Line plot data
x = -3:0.1:3;
y = x;
% Plot the line
plot(x, y, '-r', 'LineWidth', 1.5);
% Using "text" to add in-line label on the line plot
labelIndex = find(x == 0);
text(x(labelIndex), y(labelIndex), ' y = x ', 'BackgroundColor', 'w', 'VerticalAlignment', 'middle', 'HorizontalAlignment', 'center', 'Color', 'r');
% Customize plot
xlabel('X-axis');
ylabel('Y-axis');
title('Contour and Line Plot with In-line Labels');
grid on;
hold off;
Hope this helps!