How to write _ in a plot legend?

xxx = {'a_b'}
plot(1:5)
legend(xxx)
>> result is
i want to 'a_b' in legend .......
How to write ??

 Risposta accettata

Set the interpreter to 'none'
xxx = {'a_b'};
plot(1:5)
legend(xxx,'interpreter','none')

1 Commento

very very very very very very very very very Thank you !!!!
happy new year ~!~!

Accedi per commentare.

Più risposte (2)

  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