How to write _ in a plot legend?

71 次查看(过去 30 天)
xxx = {'a_b'}
plot(1:5)
legend(xxx)
>> result is
i want to 'a_b' in legend .......
How to write ??

采纳的回答

Cris LaPierre
Cris LaPierre 2021-2-4
Set the interpreter to 'none'
xxx = {'a_b'};
plot(1:5)
legend(xxx,'interpreter','none')
  1 个评论
도현 김
도현 김 2021-2-4
very very very very very very very very very Thank you !!!!
happy new year ~!~!

请先登录,再进行评论。

更多回答(2 个)

Walter Roberson
Walter Roberson 2021-2-4
legend(xxx, 'interpreter', 'none')

weikang zhao
weikang zhao 2021-2-4
  1. change the Interpreter like other answers
  2. Tex has its own escape for _ :
legend('a\_b');

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by