Disabling printing underscore as subscript in figures

952 views (last 30 days)
AP
AP on 11 Jun 2011
Answered: HE on 5 May 2020
Underscores print as subscript in figures. Can I disable it because I want to print the underscores as well.
Thanks.
  2 Comments
Michael Marcus
Michael Marcus on 11 Apr 2019
I did find out another way to keep the underscore. \_ does work ? I have answered my own question? Convert all underscores in the text to \_ instead of changing the interpreter to none.

Sign in to comment.

Accepted Answer

Walter Roberson
Walter Roberson on 11 Jun 2011
Edited: Image Analyst on 17 Jan 2018
Set the Interpreter property for that field to 'none'; the default for text() fields is LaTex.
title('This_title has an underline', 'Interpreter', 'none'); % Also works with xlabel() and ylabel()
  9 Comments
Walter Roberson
Walter Roberson on 12 Apr 2018
AM is correct: although legend() does not accept that name/value pair, you can set it on the handle.

Sign in to comment.

More Answers (1)

HE
HE on 5 May 2020
If you are using sprintf, \\_ should work for you.
old_cells = sprintf('Old cells: Y = %3.3f (X) \\^ %1.3f',coefs_old);
young_cells = sprintf('Young cells: Y = %3.3f (X) \\^%1.3f',coefs_young);

Tags

Community Treasure Hunt

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

Start Hunting!