Effacer les filtres
Effacer les filtres

How to change the color of a title?

215 vues (au cours des 30 derniers jours)
Bob Choy
Bob Choy le 18 Nov 2012
Réponse apportée : qwert le 20 Mai 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 commentaire
Jan
Jan le 18 Nov 2012
Important information from the comments: The questions concerns OCTAVE !

Connectez-vous pour commenter.

Réponses (2)

Jan
Jan le 18 Nov 2012
Modifié(e) : Jan le 18 Nov 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 commentaires
John Kearns
John Kearns le 5 Mai 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 le 5 Mai 2022
title(STRING, 'interpreter', 'latex')

Connectez-vous pour commenter.


qwert
qwert le 20 Mai 2024
\color[rgb]{0,0.447,0.741}

Catégories

En savoir plus sur Octave dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by