Effacer les filtres
Effacer les filtres

TEXT or ANNOTATION multiple Colors, Multiple Lines

15 vues (au cours des 30 derniers jours)
Philip
Philip le 22 Fév 2019
Commenté : Philip le 23 Fév 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 commentaires
Walter Roberson
Walter Roberson le 22 Fév 2019
Modifié(e) : Walter Roberson le 22 Fév 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 le 23 Fév 2019
That worked, I'll switch back to tex

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by