Borrar filtros
Borrar filtros

different colors for the title

38 visualizaciones (últimos 30 días)
MINA
MINA el 11 de Mzo. de 2020
Comentada: MINA el 11 de Mzo. de 2020
I want to have different colors for different words in the title how can I do that? something like this:
p.col=[0.5 0.5 0.5; 0.1 0.1 0.1];
title({['\color[rgb]{p.color(1,:)','A= ',num2str(A),' \color[rgb] {p.color(2,:)} B= ,num2str(B))]},'fontsize',12)
I don't know how I can give a variable as a color specifier.

Respuesta aceptada

Ameer Hamza
Ameer Hamza el 11 de Mzo. de 2020
You need to carefully compose the string. There are syntax error in your statement. Try
A = 1;
B = 1;
p.col=[1 0 0; 0 0 1];
t = title([ ...
'\color[rgb]{' sprintf('%1.2f,%1.2f,%1.2f', p.col(1,:)) '} A= ' num2str(A), ...
',\color[rgb]{' sprintf('%1.2f,%1.2f,%1.2f', p.col(2,:)) '} B= ' num2str(B)], ...
'fontsize',12, 'Interpreter', 'tex');

Más respuestas (0)

Categorías

Más información sobre Visual Exploration en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by