Change portion of text color in matlab label

66 ビュー (過去 30 日間)
Nathaniel H Werner
Nathaniel H Werner 2020 年 1 月 28 日
回答済み: Walter Roberson 2020 年 1 月 29 日
I know that it is possible to change the color of a label in a figure in matlab from the default black to another color. I have a need to change only part of the label text to a different color. For example.
h = xlabel('black, red');
set(h, 'Color',[1, 0 ,0])
This should change the entire text to red instead of black, but I'd only like to change the color of the word red.

採用された回答

Walter Roberson
Walter Roberson 2020 年 1 月 29 日
xlabel('black, \color{red}red', 'interpreter', 'tex')

その他の回答 (1 件)

Image Analyst
Image Analyst 2020 年 1 月 29 日
Might have to look up Latex commands and embed Latex commands in the string. I don't know the Latex commands off the top of my head.

カテゴリ

Help Center および File ExchangeLabels and Annotations についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by