How to rotate xline label with vertical orientation?

26 visualizaciones (últimos 30 días)
Sofia Flora
Sofia Flora el 5 de Sept. de 2024
Comentada: Sofia Flora el 5 de Sept. de 2024
Hello, in my figure I have a xline with a label. The orientation of this label is vertical and can be read from the bottom to the top of the figure. I need a rotated label, always in a vertical orientation but readable from the top to the bottom. Is it possible?
Many thanks,
Sofia

Respuesta aceptada

Shivam
Shivam el 5 de Sept. de 2024
Hi Sofia,
You can follow the workaround mentioned to get the text label in vertical orientation but readable from the top to the bottom.
% Add an xline
xlinePosition = 5; % Example position for the xline
xline(xlinePosition, 'Color', 'r', 'LineWidth', 2);
% Add a custom text label for the xline
labelText = 'My Label';
% Adjust y position and 'VerticalAlignment' as needed
text(xlinePosition, max(y), labelText, 'Rotation', -90, ...
'VerticalAlignment', 'bottom', 'HorizontalAlignment', 'left');
You can make the position adjustments of the line and text label according to your needs.
I hope it is helpful.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by