How to write _ in a plot legend?

45 visualizzazioni (ultimi 30 giorni)
도현 김
도현 김 il 4 Feb 2021
Commentato: 도현 김 il 4 Feb 2021
xxx = {'a_b'}
plot(1:5)
legend(xxx)
>> result is
i want to 'a_b' in legend .......
How to write ??

Risposta accettata

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

Accedi per commentare.

Più risposte (2)

Walter Roberson
Walter Roberson il 4 Feb 2021
legend(xxx, 'interpreter', 'none')

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

Tag

Community Treasure Hunt

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

Start Hunting!

Translated by