# Simple xline with all options

13 views (last 30 days)
Hagen Übele on 25 Oct 2021
Answered: Steven Lord on 25 Oct 2021
I simply want to add an xline with
a specified position, a specified color, a specified linewidth, a label and a specified label position.
I have tried every pertubation of what I think is possible, but it never works. Best I can achieve is a line with a specified color and a label on the left side. As soon as I try to add a linewidth it only returns invalid parameter/value pair.
It would be very helfpful if somebody could tell me how this is supposed to work.

Steven Lord on 25 Oct 2021
From the documentation, note that labels comes after the LineSpec but before any name-value pair arguments as stated in the fourth syntax in the Description section.
xline(0.5, 'r--', ... % This is the LineSpec, the label comes next
'$x = \frac{1}{2}$', ... % Only name-value pair arguments after this point
'LineWidth', 3, ...
'Interpreter', 'latex', ...
'LabelOrientation', 'horizontal')