TEXT or ANNOTATION multiple Colors, Multiple Lines

조회 수: 36 (최근 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 CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by