Borrar filtros
Borrar filtros

How to change the color of a title?

180 visualizaciones (últimos 30 días)
Bob Choy
Bob Choy el 18 de Nov. de 2012
Respondida: qwert el 20 de Mayo de 2024
Im using the title(STRING) function to insert a title in the graph I made with the plot funcion. But I need the string to have a certain color, in this case I actually want to have the title saying:
"Month1(in magenta), Month2(in cyan), Month3(in red)"
Obviously I dont want the brackets to be there, its just so you understand what colors I want. How can I do this?
Thank you.
P.S: If there is any easier way of placing a small colored label/title in a graph other than the title(STRING) function, please do tell me!
  1 comentario
Jan
Jan el 18 de Nov. de 2012
Important information from the comments: The questions concerns OCTAVE !

Iniciar sesión para comentar.

Respuestas (2)

Jan
Jan el 18 de Nov. de 2012
Editada: Jan el 18 de Nov. de 2012
title('\color{magenta}Month1, \color{cyan}Month2, \color{red}Month3')
It is hard to imagine, that there could be an easier solution. Isn't this nice?
  6 comentarios
John Kearns
John Kearns el 5 de Mayo de 2022
Hey Jan,
Sorry to be late to the party on this old post, but do you know if this is possible to change the string colors to colors that are not representable with a single character? I have tried
title(['\color{#CA0066}Mean Vorticity Magnitude'])
as well as
title(['\color{[1. .4 .7020]}Mean Vorticity Magnitude'])
and both of these yielded outputs that were the verbatum title string.
Basically, my aim with this is to be able to use the default color order from plotyy() colors and color the variables represented on the respective axes in my title by the color they are plotted in. So, something similar to the output of
title(['\color{blue}Mean Vorticity Magnitude \color{black}with \color{magenta}Slice Area'])
but with the colors of [0 0.4470 0.7410] and [0.8500 0.3250 0.0980].
I appreciate any help you can offer! Thanks in advance for all the posts you've commented on that have been very instructive for me as I've worked on various problems.
Cheers,
John
Walter Roberson
Walter Roberson el 5 de Mayo de 2022
title(STRING, 'interpreter', 'latex')

Iniciar sesión para comentar.


qwert
qwert el 20 de Mayo de 2024
\color[rgb]{0,0.447,0.741}

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by