How can I assign different colors to two-line plot title?
Show older comments
Hello,
I want to assign different colors to each line of the two-line plot title. I tried to solve as,
title({'FAS of NS';'Select the low filter limit'},'Color',{'m';'r'});
but I couldn't get a result. Can you please help find a solution?
Accepted Answer
More Answers (1)
Mayra
on 29 May 2021
It was complicate for me to realize that we simply need to create a string as described in the help center, which is:
title(['\fontsize{16}black {\color{magenta}magenta '...
'\color[rgb]{0 .5 .5}teal \color{red}red} black again'])
In my case I created two strings:
t1 - title at the first line
t2 - title at the second line
The colors for each line were C1 and C2 in rgb form (e.g. C1 = [ 5.95010505e-01, 7.71902878e-02, 6.27916992e-01];
Then it was necessary create two new strings combining my title, the command for color and the color itself:
title({['\color[rgb]{',num2str(C1),'}',t1],...
['\color[rgb]{',num2str(C2),'}',t2]})
Categories
Find more on Title in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!