R: Create plots in your university or company colors

PowerPoint (or Beamer) presentations look so much better if the colors of the slide headers somewhat match the colors of the text and figures. Many of the plots that I make, are created with R.  I find it easy to have the colors of my university (Ghent University) available in R. Below some simple slides made with the great UGent Beamer extension.

ugent fw

tw eb

The rgb() function in the grDevices package makes it very easy to define new colors. If you want to add your own university of company colors, you just need to know the red-green-blue codes of the colors you want to add.

If you don’t know the RGB values of the colors you want to add, you can just open your logo in MS Paint (or similar) and use the color-pick tool. This will give you the required RGB values. Below an example of the color-pick tool in KolourPaint.


Finally, to make your new colors available when R starts up, just define the new colors in your Rprofile file. Just make sure that you FIRST load the grDevices library or an error will occur. For example, if you want to use the Ghent University colors, just add the following lines to your Rprofile:

# Pantone 534: global
ugentblue <- rgb(36,71,127,maxColorValue=250)
# Pantone 130: generic colour
ugentyellow <- rgb(250,178,10,maxColorValue=250)
# Pantone 103c: Faculty of Literature & Philosophy
ugent_lw <- rgb(214,198,0,maxColorValue=250)
# Pantone 485c: Faculty of Law
ugent_re <- rgb(238,39,34,maxColorValue=250)
# Pantone 292c: Faculty of Science
ugent_we <- rgb(131,194,236,maxColorValue=250)
# Pantone 702: Faculty of Medicine and Health Sciences
ugent_ge <- rgb(232,80,118,maxColorValue=250)
# Pantone 272c: Faculty of Engineering and Architecture
ugent_tw <- rgb(116,121,197,maxColorValue=250)
# Pantone 556c: Faculty of Economics and Business Administration
ugent_eb <- rgb(113,165,136,maxColorValue=250)
# Pantone 2583c: Faculty of Veterinary Medicine
ugent_di <- rgb(145,94,182,maxColorValue=250)
# Pantone 1655c: Faculty of Psychology and Educational Sciences
ugent_pp <- rgb(244,106,37,maxColorValue=250)
# Pantone 3262c: Faculty of Bioscience Engineering
ugent_la <- rgb(74,194,182,maxColorValue=250)
# Pantone purple: Faculty of Pharmaceutical Sciences
ugent_fw <- rgb(163,43,155,maxColorValue=250)
# Pantone 375c: Faculty of Political and Social Sciences
ugent_ps <- rgb(159,217,93,maxColorValue=250)

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )


Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s