[R] Opposite color in R
ken knoblauch
ken.knoblauch at inserm.fr
Sun Jul 26 08:45:34 CEST 2015
peter dalgaard <pdalgd <at> gmail.com> writes:
>
>
> > On 25 Jul 2015, at 21:49 , Atte Tenkanen
<attenka <at> utu.fi> wrote:
> >
> > 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?
>
> Not directly, but a few hints:
>
> First read up on "complementary colors" in
Wikipedia. In particular, note that the traditional color
> circle does not satisfy the modern definition
of opposite-ness. E.g. red paint mixed with green paint is
> brown, not black or grey.
>
> The construction of the color circle is simple
in principle: red, blue, yellow go at 0, 120, 240 degrees, the
> other colors on the circle are formed by mixing
two primaries in varying proportions: green (at 180 deg) is
> an equal mixture of blue and yellow, violet
(at 60 deg) of blue and red, orange (at 300 deg)
of red and yellow.
> Blue-green (at 150 deg) would be half blue,
half green, alias three quarter blue, one quarter
yellow. Etc.
>
> The tricky bit is that the above mixtures are
subtractive mixtures (mixing paint rather than light beams)
> and I don't know how to make a subtractive
color mixture in the additive RGB space
that we usually work in.
> Maybe there are tools in the colortools package?
>
> -pd
>
> >
> > Atte Tenkanen
To start with, you should be specifying your "colors"
or lights actually in an additive color space like
CIE 1931 xy,
https://en.wikipedia.org/wiki/CIE_1931_color_space
which you can do in the colorspace package.
But this is based on an average observer and
the results are unlikely to match a given
individual's vision. On top of that, decisions made
when this norm was specified are such that it
deviates from human vision for short wavelengths
so that you would be better off using a corrected
version like that proposed by Judd in the 1950's
or for the most recent suggestion see
ww.cvrl.org
under
New CIE XYZ functions transformed
from the CIE (2006) LMS functions
best,
Ken
--
Kenneth Knoblauch
Inserm U846
Stem-cell and Brain Research Institute
Department of Integrative Neurosciences
18 avenue du Doyen Lépine
69500 Bron
France
tel: +33 (0)4 72 91 34 77
fax: +33 (0)4 72 91 34 61
portable: +33 (0)6 84 10 64 10
http://www.sbri.fr/members/kenneth-knoblauch.html
More information about the R-help
mailing list