How to rotate xline label with vertical orientation?

26 ビュー (過去 30 日間)
Sofia Flora
Sofia Flora 2024 年 9 月 5 日
コメント済み: Sofia Flora 2024 年 9 月 5 日
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 Center および File ExchangeMultirate Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by