Filter löschen
Filter löschen

TEXT or ANNOTATION multiple Colors, Multiple Lines

15 Ansichten (letzte 30 Tage)
Philip
Philip am 22 Feb. 2019
Kommentiert: Philip am 23 Feb. 2019
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 Kommentare
Walter Roberson
Walter Roberson am 22 Feb. 2019
Bearbeitet: Walter Roberson am 22 Feb. 2019
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 am 23 Feb. 2019
That worked, I'll switch back to tex

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by