On 17/01/13 17:37, Rainer M Krug wrote: > On 17/01/13 17:18, Alex Vergara Gil wrote: >>> Hi >>> >>> I have line graphs generated in R, where each line is in a different colour >>> (the colours >>> are generated in R by using rainbow(8)). >>> >>> Due to space problems in the graph, I can not put the legend into the >>> grapgh itself, but >>> want to put it into the caption. Therefore I would like to reproduce the >>> colours in LaTeX. >>> I know how to set the text colour via LyX to one of the pre-defined >>> colours, but hjow can I >>> set them to these specific colours? >>> >>> In addition, I would like to have the colours as filled squares in the text >>> - any >>> suggestions? >>> >> >> >> Oh you mean by adding \textcolor{yourcolor}{$\blacksquare$yourcaption} in an >> ERT > > Perfect - thanks. > > Now I just have to figure out how to translate the colour codes in R into > LaTeX readable. The > eight colours in R are: > > "#FF0000FF" "#FFBF00FF" "#80FF00FF" "#00FF40FF" "#00FFFFFF" "#0040FFFF" > "#8000FFFF" > "#FF00BFFF"
Solved: I just have to leave out the last two characters, as the first 6 represent the rgb colors in hex. so #FF0000FF translates into: [[ \textcolor[HTML]{FF0000}{$\blacksquare$ ]] my caption [[ } ]] where [[ ]] stands for ERT. And I have a filled square in the text and the caption in the colour used in R for plotting. Thanks, Rainer > > Thanks, > > Rainer > >> >> Regards >> >> Alex >> > -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Stellenbosch University South Africa Tel : +33 - (0)9 53 10 27 44 Cell: +33 - (0)6 85 62 59 98 Fax : +33 - (0)9 58 10 27 44 Fax (D): +49 - (0)3 21 21 25 22 44 email: rai...@krugs.de Skype: RMkrug