MATLAB Answers

legend command and the Tex interpreter

26 ビュー (過去 30 日間)
Tomy Duby
Tomy Duby 2016 年 9 月 8 日
回答済み: Robert 2016 年 9 月 8 日
How can I prevent the legend command to interpret a string as it were a Tex string? For example, str = 'pdf_ParA'. If I use legend( str ) the letter P is displayed as a subscript.

  0 件のコメント



Robert 2016 年 9 月 8 日
You can use
where L is your legend handle or object. You could either return L when you create the legend,
L = legend(...);
or find it with
L = findobj(gcf,'Tag','legend');
Alternatively, if you want other legend entiries to still be interpreted, you can escape the underscores and backslashes in your string with strrep. i.e.,
mystr = strrep(mystr,'\','\\');
mystr = strrep(mystr,'_','\_');

  0 件のコメント


その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by