Disabling printing underscore as subscript in figures

593 vues (au cours des 30 derniers jours)
AP
AP le 11 Juin 2011
Commenté : Eliot le 16 Avr 2025
Underscores print as subscript in figures. Can I disable it because I want to print the underscores as well.
Thanks.
  2 commentaires
Michael Marcus
Michael Marcus le 11 Avr 2019
Modifié(e) : Stephen23 le 11 Avr 2019
Although this allows underscores to print, it does not allow special symbols such as \mum to work.. Does anyone know how to allow both.
Mike Marcus
Michael Marcus
Michael Marcus le 11 Avr 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.

Connectez-vous pour commenter.

Réponse acceptée

Walter Roberson
Walter Roberson le 11 Juin 2011
Modifié(e) : Image Analyst le 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()
  13 commentaires
Yulong Li
Yulong Li le 9 Mai 2023
@Walter Roberson got it, thanks!
Eliot
Eliot le 16 Avr 2025
Thank you for this easy solution to my messed-up plot titles!

Connectez-vous pour commenter.

Plus de réponses (1)

HE
HE le 5 Mai 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);

Catégories

En savoir plus sur Creating, Deleting, and Querying Graphics Objects dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by