Simple xline with all options

244 visualizaciones (últimos 30 días)
Hagen Übele
Hagen Übele el 25 de Oct. de 2021
Comentada: Steven Lord el 2 de Feb. de 2022
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.

Respuestas (1)

Steven Lord
Steven Lord el 25 de Oct. de 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')
  2 comentarios
CAME18
CAME18 el 2 de Feb. de 2022
Is there any way to have the label with a different color than the line?. For example:
in the example you provided, have the label with black letters instead of red, as the line's color.
Steven Lord
Steven Lord el 2 de Feb. de 2022
There's no ConstantLine property for this, but if you leave the Interpreter property set to 'tex' (the default) you could include \color in your label. See the Interpreter section on this documentation page for a list of the supported markup available for use in TeX labels.
h = xline(0.5, 'r:', ... % line specification
'\color{black}black \color{red}and \color{blue}blue', ... % label text
'LineWidth', 4, ... % name-value pair arguments from this point on
'LabelOrientation', 'horizontal');

Iniciar sesión para comentar.

Categorías

Más información sobre Geometric Transformation and Image Registration en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by