Different colors for different text in a single textbox
42 ビュー (過去 30 日間)
古いコメントを表示
Is it possible to have different colors for different text in a single text box?
For example,
1st line of text is black
2nd line of text is blue
3rd line of text is red.
0 件のコメント
採用された回答
Voss
2022 年 12 月 24 日
str = { ...
'\color{black}1st line of text', ...
'\color{blue}2nd line of text', ...
'\color{red}3rd line of text'};
t = text(0.5,0.5,str);
4 件のコメント
Walter Roberson
2025 年 5 月 28 日
str = '\color[rgb]{0.1,0.8,0.95} Sample rgb text';
text(0.5,0.5,str)
Note that for this to work, the text() Interpreter property must be 'tex' (which is the default)
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Statistics and Machine Learning Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

