Newline in stackedplot XTickLabel

5 ビュー (過去 30 日間)
Daniel
Daniel 2022 年 11 月 2 日
回答済み: Abhaya 2024 年 10 月 14 日
I set the XTicklabel of my stackedplot splot by:
ax = findobj(splot.NodeChildren,'Type','Axes');
ax(1).XTickLabel = tickName;
where tickName is a cell array with the same length as the XTicks. Every cell contains a character vector. Every second cell's character vector starts with '\newline '. Instead of starting in a new line, the XTickLabel just print the text \newline. This behaviour does not occur when I use a subplot for example.
Is there a way to overcome this issue? If not, can the position of the labels be set in a different way?

回答 (1 件)

Abhaya
Abhaya 2024 年 10 月 14 日
Hi Daniel,
I understand that you are trying to add a new line to “XTickLabel” values using character vector ‘\newline’.
To achieve this, you can change the value of the “TickLabelIntepreter” property of axes from ‘none’ to ‘tex’.
ax(1).TickLabelInterpreter = 'tex';
For more information, please refer to the following documentation.
Hope this solves your query.

カテゴリ

Help Center および File ExchangeAxis Labels についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by