[R] Opposite color in R

Steve Taylor steve.taylor at aut.ac.nz
Tue Jul 28 01:23:18 CEST 2015


I wonder if the hcl colour space is useful?  Varying hue while keeping chroma and luminosity constant should give varying colours of perceptually the same "colourness" and brightness.

?hcl
pie(rep(1,12),col=hcl((1:12)*30,c=70),border=NA)


-----Original Message-----
From: R-help [mailto:r-help-bounces at r-project.org] On Behalf Of Atte Tenkanen
Sent: Sunday, 26 July 2015 7:50a
To: r-help at r-project.org
Subject: [R] Opposite color in R

Hi,

I have tried to find a way to find opposite or complementary colors in R.

I would like to form a color circle with R like this one: 
http://nobetty.net/dandls/colorwheel/complementary_colors.jpg

If you just make a basic color wheel in R, the colors do not form 
complementary color circle:

palette(rainbow(24))
Colors=palette()
pie(rep(1, 24), col = Colors)

There is a package ”colortools” where you can find function opposite(), 
but it doesn’t work as is said. I tried

library(colortools)
opposite("violet") and got green instead of yellow and

opposite("blue") and got yellow instead of orange.

Do you know any solutions?

Atte Tenkanen

______________________________________________
R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


More information about the R-help mailing list