Latex text in Y-Axis

1 回表示 (過去 30 日間)
Brave A
Brave A 2021 年 3 月 6 日
回答済み: Star Strider 2021 年 3 月 6 日
Hi,
I am trying to add text and D_i to y-axis, but it gives error. Could you please help?
xlabelname = sprintf('Number of Samples','${D_{i}}$' );
xlabel(xlabelname, 'fontsize', 30, 'interpreter', 'latex')
thanks in advance!

採用された回答

Star Strider
Star Strider 2021 年 3 月 6 日
It does not throw any errors, it just does not do what you want it to do.
Try this instead:
xlabelname = {'Number of Samples','${D_{i}}$'};
That worked when I ran it.
The sprintf call is not necessary here, however if you want to use it:
xlabelname = sprintf('Number of Samples\n${D_{i}}$' );
produces the same result (note the added ‘\n’ newline character).

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by