How to change the color of a title?

221 次查看(过去 30 天)
Bob Choy
Bob Choy 2012-11-18
回答: qwert 2024-5-20
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 个评论
Jan
Jan 2012-11-18
Important information from the comments: The questions concerns OCTAVE !

请先登录,再进行评论。

回答(2 个)

Jan
Jan 2012-11-18
编辑:Jan 2012-11-18
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 个评论
John Kearns
John Kearns 2022-5-5
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

请先登录,再进行评论。


qwert
qwert 2024-5-20
\color[rgb]{0,0.447,0.741}

类别

Help CenterFile Exchange 中查找有关 Octave 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by