How to rotate xline label with vertical orientation?

26 次查看(过去 30 天)
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

采纳的回答

Shivam
Shivam 2024-9-5
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by