Filter löschen
Filter löschen

How to change the color of a title?

180 Ansichten (letzte 30 Tage)
Bob Choy
Bob Choy am 18 Nov. 2012
Beantwortet: qwert am 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 Kommentar
Jan
Jan am 18 Nov. 2012
Important information from the comments: The questions concerns OCTAVE !

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Jan
Jan am 18 Nov. 2012
Bearbeitet: Jan am 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 Kommentare
John Kearns
John Kearns am 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 am 5 Mai 2022
title(STRING, 'interpreter', 'latex')

Melden Sie sich an, um zu kommentieren.


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

Community Treasure Hunt

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

Start Hunting!

Translated by