TEXT or ANNOTATION multiple Colors, Multiple Lines

37 ビュー (過去 30 日間)
Philip
Philip 2019 年 2 月 22 日
コメント済み: Philip 2019 年 2 月 23 日
I want to input text in one box with multiple colors and multiple lines using Latex commands.
Ive tried everythig, nothing seems to work.
Looping through text...
color = {'b','y','g',};
words={' {$\rho= 5 cm$ }',' $\rho 10 cm$ ',' $\rho 20 cm$ '};
for i = length(color)
figure(1)
text('Position',...
[0.5 0.5-(i*.1)],...
'Interpreter','latex','String',words,'Color',color{i});
end
Annotation with latex etc,
words='\bf{ $5 cm$}';
textp={
'String',words,...
};
annotation('textbox',...
[0.15 0.65 0.3 0.15],...
'interpreter','latex',...
textp,...
'FontSize',14,...
'FontName','Times New Roman',...
'LineStyle','--',...
'EdgeColor','k',...
'LineWidth',2);
I've tried various latex commands, various approaches... nothing seems to work...
\color....
\textcolor...
There must be a simple way to create a text box with varying Latex colors etc in a plot! THanks!
  2 件のコメント
Walter Roberson
Walter Roberson 2019 年 2 月 22 日
編集済み: Walter Roberson 2019 年 2 月 22 日
The material I am finding implies you would need to \usepackage{xcolor} or \usepackage{color} for really old installations. However, neither of those packages is available for MATLAB.
\color works with interpreter tex but not latex
Philip
Philip 2019 年 2 月 23 日
That worked, I'll switch back to tex

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by