MATLAB Answers

Bob Choy

How to change the color of a title?

Asked by Bob Choy
on 18 Nov 2012

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 Comment

Jan Simon
on 18 Nov 2012

Important information from the comments: The questions concerns OCTAVE !


No products are associated with this question.

1 Answer

Answer by Jan Simon
on 18 Nov 2012
Edited by Jan Simon
on 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?


Jan Simon
on 18 Nov 2012

Yes, Bob, this is a problem and it would be a good idea to post such important information in the question already. Please note that this is Matlab forum, such that your question is off-topic.

Bob Choy
on 18 Nov 2012

Im sorry, I didn't know this was such a deep offense, especially when most people learn octave just because its free, so they can work with matlab later on... But I guess rules are rules, and my question is going to be left unanswered.

Thank you for your support anyways.

Jan Simon
on 19 Nov 2012

It is not an offense at all and I really appreciate Octave for some jobs. But it wastes your and my time, when I post a solution concerning Matlab, while you work with another software without explaining this. What would you think, if you spend some time (although it is a minute only) in an Octave forum to answer my question, and I reveal afterwards, that I'm working with Excel?

The GUI handling of Octave and Matlab differ substantially. If you find a good Octave forum, feel free to post the link here, such that we can suggest it for future questions.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi test

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!