Predefining colors for in-text coloring

조회 수: 23 (최근 30일)
Jakob Sievers
Jakob Sievers 2014년 6월 25일
댓글: Jakob Sievers 2014년 6월 25일
Hi all
I am using the latex approach to coloring segments of e.g. a title. For example:
figure
plot(rand(10,1),'.')
title('{\color{red}this is red} and {\color{blue}this is blue}')
However, it appears that only 8 predefined colors are available automatically in Matlab. How do I expand this number, or ideally predefine color names using rgb codes myself?
Cheers
Jakob

채택된 답변

Jakob Sievers
Jakob Sievers 2014년 6월 25일
Repeated googling led me to this solution
{\color[rgb]{1 .5 .2}text}
/J
  댓글 수: 2
Image Analyst
Image Analyst 2014년 6월 25일
For completeness:
title('{\color[rgb]{1 .5 .2}This text is orange} and {\color[rgb]{0,1,1}This text is cyan}',...
'FontSize', 25, 'FontWeight', 'Bold')
Jakob Sievers
Jakob Sievers 2014년 6월 25일
Thanks. I should have written it in full form :)

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2014년 6월 25일
Why don't you just try the 'Color' option and put in RGB colors inthe range 0-1
title('This is the title', 'Color', [0.1, 0.3, 0.5]);
  댓글 수: 1
Jakob Sievers
Jakob Sievers 2014년 6월 25일
Because I need to color individual segments of the title in different colors. :)

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Text Data Preparation에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by